Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Wordpress hook for newly published post

function so_post_40744782( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' && $old_status != 'publish' ) {
        $author = "foobar";
        $message = "We wanted to notify you a new post has been published.";
        wp_mail($author, "New Post Published", $message);
    }
}
add_action('transition_post_status', 'so_post_40744782', 10, 3 );
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Wordpress #hook #newly #published #post
ADD COMMENT
Topic
Name
2+7 =