Last active
November 27, 2017 14:05
-
-
Save mauriciogofas/1310330d46227d6574ca to your computer and use it in GitHub Desktop.
Notifica admin sobre post para revisão
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Notifica admin sobre post para revisão | |
| function send_mail_post_pending( $post_id, $post ) { | |
| $post_status = get_post_status( $post ); | |
| if( $post_status === 'pending' && ! wp_is_post_revision( $post ) ) { | |
| $email = ( '[email protected]' ); | |
| $subject = 'Revisar novo post'; | |
| $message = 'Título do post: ' . get_the_title( $post ) . "\n\n"; | |
| $message .= 'Revisar o post: ' . admin_url( "post.php?post={$post_id}&action=edit" ); | |
| wp_mail( $email, $subject, $message ); | |
| } | |
| } | |
| add_action( 'save_post', 'send_mail_post_pending', 10, 2 ); | |
| // Fim | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment