Make WordPress Core

Changeset 17452


Ignore:
Timestamp:
02/15/2011 11:58:42 PM (14 years ago)
Author:
ryan
Message:

Run parse_query() in get_posts() so that the query vars are always parsed for set(), get_posts() patterns. fixes #16545 for 3.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/wp-includes/query.php

    r17436 r17452  
    13131313     */
    13141314    function parse_query_vars() {
    1315         $this->parse_query('');
     1315        $this->parse_query();
    13161316    }
    13171317
     
    13841384     * @access public
    13851385     *
    1386      * @param string|array $query
    1387      */
    1388     function parse_query($query) {
    1389         if ( !empty($query) || !isset($this->query) ) {
     1386     * @param string|array $query Optional query.
     1387     */
     1388    function parse_query( $query =  '' ) {
     1389        if ( ! empty( $query ) ) {
    13901390            $this->init();
    1391             $this->query = $this->query_vars = wp_parse_args($query);
     1391            $this->query = $this->query_vars = wp_parse_args( $query );
     1392        } elseif ( ! isset( $this->query ) ) {
     1393            $this->query = $this->query_vars;
    13921394        }
    13931395
     
    18711873    function &get_posts() {
    18721874        global $wpdb, $user_ID, $_wp_using_ext_object_cache;
     1875
     1876        $this->parse_query();
    18731877
    18741878        do_action_ref_array('pre_get_posts', array(&$this));
     
    28522856     * @return array List of posts.
    28532857     */
    2854     function &query($query) {
    2855         $this->parse_query($query);
     2858    function &query( $query ) {
     2859        $this->init();
     2860        $this->query = $this->query_vars = wp_parse_args( $query );
    28562861        return $this->get_posts();
    28572862    }
Note: See TracChangeset for help on using the changeset viewer.