I am using a wp_update_post to change the status of a post from published to pending using wp_update_post( array( 'ID' => $post_id, 'post_status' => 'Pending', ) );
with code I can change the status but when I want to save and publish the post from admin area after chaning the status and hit publish, there is some king of loop is happening and nothing will be saved after waiting several minutes post update will be failed.

  • Please provide more of the code you're using like the action you hooked on. – Zlatev Nov 8 '16 at 14:04
  • add_action( 'init', array($this, 'my_custom_function') ); this is the hook I am using when updating the post – MMT designer Nov 8 '16 at 14:07
  • 1
    Update your question with that and the contents of my_custom_function(). – Zlatev Nov 8 '16 at 14:10
  • this function is too big – MMT designer Nov 8 '16 at 14:11
  • Hard to help then – Zlatev Nov 8 '16 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.