What is the difference between wp_reset_query() and wp_reset_postdata() in WordPress?
wp_reset_query() | wp_reset_postdata() |
---|---|
This ensures that the query has been reset to the originally created main query. | This ensures that the global $post has been restored in the current post inside the main query. |
Should be used immediately after every loop using query_posts() | Should be used after every custom WP_Query() |
BY Best Interview Question ON 07 Mar 2020