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

admin2025-04-25  0

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 );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745528229a305480.html

最新回复(0)