wp_reset_postdata()
After looping through a separate query, this function restores the $post global to the current post in the main query.
Description Description
Source Source
File: wp-includes/query.php
function wp_reset_postdata() { global $wp_query; if ( isset( $wp_query ) ) { $wp_query->reset_postdata(); } }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example of secondary loop and reset
Expand full source codeCollapse full source code
WARNING, only reset the post data if the query is successful…