📜  新发布的帖子的 Wordpress 挂钩 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:48.951000             🧑  作者: Mango

代码示例1
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 );