Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function post_published_notification( $ID, $post ) {
- $author = $post->post_author; /* Post author ID. */
- $name = get_the_author_meta( 'display_name', $author );
- $email = get_the_author_meta( 'user_email', $author );
- $title = $post->post_title;
- $permalink = get_permalink( $ID );
- $edit = get_edit_post_link( $ID, '' );
- $to[] = sprintf( '%s <%s>', $name, $email );
- $subject = sprintf( 'Published: %s', $title );
- $message = sprintf ('Congratulations, %s! Your article ā%sā has been published.' . "\n\n", $name, $title );
- $message .= sprintf( 'View: %s', $permalink );
- $headers[] = '';
- wp_mail( $to, $subject, $message, $headers );
- }
- add_action( 'publish_post', 'post_published_notification', 10, 2 );
- function my_trash_action( $post_id ) {
- if ( 'custom_post_type' != get_post_type( $post_id )
- return;
- //Do Stuff....
- }
- add_action( 'trashed_post', 'my_trash_action' );
- add_action('before_delete_post', 'my_deleted_post');
- function my_deleted_post($post_id){
- wp_die(var_dump($post_id));
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement