I have scheduled posts to publish automatically in future. I want when theses posts are published do some stuffs, so I used below code:

add_action( 'publish_post', 'after_post_published' );
add_action( 'publish_future_post', 'after_post_published' );
add_action( 'future_to_publish', 'after_post_published' );

function after_post_published($postid) {
  update_post_meta( $postid, 'is_fired', true );

The results (post meta) tells none of these action hooks are fired.

all above action hooks works fine with posts which published at current time but not work with scheduled posts.

I tried many different codes and now confused with the case. Thanks


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.