Add action when published in the core script
-
Dear AlexBenfica,
I wish that a script is executed everytime a post is published from a schedule but every hook I added in functions.php doesn’t work, they are:
function pubblica_img_fb($post_id) { if (( $_POST['post_status'] == 'publish' ) && ( $_POST['original_post_status'] != 'publish' ) ) { wp_mail( '[email protected]', 'test', 'test' ); } } add_action( 'publish_post', 'pubblica_img_fb', 10, 3); add_action('publish_future_post', 'pubblica_img_fb'); add_action('future_to_publish', 'pubblica_img_fb'); add_action( 'draft_to_publish', 'your_callback' );
So, because it’s not working with none of them, I’ve tried to add a simple script in the core script, exactly in the pts_do_publish_schedule function which is:
wp_mail( '[email protected]', 'test', 'test' );
but still, it doesn’ works!
So I’m here asking you where should I add some PHP code in order to be executed ONLY when the post is really published.
Thank you very much
Best
Simone
- The topic ‘Add action when published in the core script’ is closed to new replies.