Ticket #16545: 16545.diff
File 16545.diff, 2.1 KB (added by , 14 years ago) |
---|
-
wp-includes/query.php
1240 1240 var $parsed_tax_query = false; 1241 1241 1242 1242 /** 1243 * Whether the query has been parsed once. 1244 * 1245 * @since 3.1.0 1246 * @access private 1247 * @var bool 1248 */ 1249 var $parsed_query = false; 1250 1251 /** 1243 1252 * Resets query flags to false. 1244 1253 * 1245 1254 * The query flags are what page info WordPress was able to figure out. … … 1312 1321 * @access public 1313 1322 */ 1314 1323 function parse_query_vars() { 1315 $this->parse_query( '');1324 $this->parse_query(); 1316 1325 } 1317 1326 1318 1327 /** … … 1383 1392 * @since 1.5.0 1384 1393 * @access public 1385 1394 * 1386 * @param string|array $query 1395 * @param string|array $query Optional query. 1387 1396 */ 1388 function parse_query( $query) {1389 if ( ! empty($query) || !isset($this->query) ) {1397 function parse_query( $query = '' ) { 1398 if ( ! empty( $query ) ) { 1390 1399 $this->init(); 1391 $this->query = $this->query_vars = wp_parse_args($query); 1400 $this->query = $this->query_vars = wp_parse_args( $query ); 1401 } elseif ( ! isset( $this->query ) ) { 1402 $this->query = $this->query_vars; 1392 1403 } 1393 1404 1394 1405 $this->query_vars = $this->fill_query_vars($this->query_vars); … … 1625 1636 if ( '404' == $qv['error'] ) 1626 1637 $this->set_404(); 1627 1638 1639 // Mark the query as parsed 1640 $this->parsed_query = true; 1641 1628 1642 if ( !empty($query) ) 1629 1643 do_action_ref_array('parse_query', array(&$this)); 1630 1644 } … … 1871 1885 function &get_posts() { 1872 1886 global $wpdb, $user_ID, $_wp_using_ext_object_cache; 1873 1887 1888 // If we haven't parsed the query already, we should do that now 1889 if ( ! $this->parsed_query ) 1890 $this->parse_query(); 1891 1892 $this->parsed_query = false; // Reset it 1893 1874 1894 do_action_ref_array('pre_get_posts', array(&$this)); 1875 1895 1876 1896 // Shorthand. … … 2851 2871 * @param string $query URL query string. 2852 2872 * @return array List of posts. 2853 2873 */ 2854 function &query($query) { 2855 $this->parse_query($query); 2874 function &query( $query ) { 2875 $this->init(); 2876 $this->query = $this->query_vars = wp_parse_args( $query ); 2856 2877 return $this->get_posts(); 2857 2878 } 2858 2879