Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Set up The Loop with query parameters. This will override the current WordPress Loop and shouldn’t be used more than once. This must not be used within the WordPress Loop.

 * Signature
 * query_posts( $query )
 * @param $query (string)
 * @return (array) List of posts


function &query_posts( $query ) {
    unset( $GLOBALS['wp_query'] );
    $GLOBALS['wp_query'] = new WP_Query();
    return $GLOBALS['wp_query']->query( $query );

ref: query_posts()

history | excerpt history