Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_reset_postdata [ WordPress Function ]

wp_reset_postdata ( No parameters )
Uses:
  • $wp_query
Defined at:



After looping through a separate query, this function restores the $post global to the current post in the main query

Source


<?php
function wp_reset_postdata() {
    global 
$wp_query;
    if ( !empty(
$wp_query->post) ) {
        
$GLOBALS['post'] = $wp_query->post;
        
setup_postdata($wp_query->post);
    }
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics