custom post types - publish_post action callback not executed, why?

I create a custom post type and I insert programmatically a new post of that type with wp_insert_post with draft status.

I create a custom post type and I insert programmatically a new post of that type with wp_insert_post with draft status.

I need to send and email when in backend the post is published so I used publish_post but seems the callback function is not executed, can help me please?

    function post_published_notification( $ID, $post ) {
    /* code for testing purpose only */

    $postarr = array(
            'post_content' => 'fake content ' . $post_id,
            'post_title' => 'fake title ' . $post_id,
            'post_type' => 'gdpr_qao',
        );

    wp_insert_post( $postarr );
}
add_action( 'publish_post ', $plugin_admin, 'post_published_notification', 10, 2 );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745528207a4631571.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信