Switch language

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




wp_reset_query [ WordPress Function ]

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



Destroy the previous query and set up a new query.

This should be used after {@link query_posts()} and before another {@link query_posts()}. This will remove obscure bugs that occur when the previous wp_query object is not destroyed properly before another is set up.

Source


<?php
function wp_reset_query() {
    unset(
$GLOBALS['wp_query']);
    
$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
    
wp_reset_postdata();
}
?>

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