📅  最后修改于: 2022-03-11 14:54:48.951000             🧑  作者: Mango
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 );