admin管理员组文章数量:1130349
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 );
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 );
本文标签: custom post typespublishpost action callback not executedwhy
版权声明:本文标题:custom post types - publish_post action callback not executed, why? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1745528205a2154626.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论