Is it strictly necessary to call wp_reset_postdata(); in a WP CLI command? I am doing it out of habit but just wondered if the $post object needed to be reset.

1 Answer 1


I did a little digging and found that the answer varies depending on your situation but for the most part no. If you are using the global $post variable outside a query then maybe.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.