Docs: Add a note to the DocBlock for `query_posts()` to caution against general usage, including a pointer to the `pre_get_posts` action.
Also adds missing parameter and return descriptions. See #32246. git-svn-id: https://develop.svn.wordpress.org/trunk@37877 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
36e36e3b1d
commit
6089491477
|
@ -77,17 +77,20 @@ function set_query_var( $var, $value ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up The Loop with query parameters.
|
* Sets up The Loop with query parameters.
|
||||||
*
|
*
|
||||||
* This will override the current WordPress Loop and shouldn't be used more than
|
* Important: This will completely override the current WordPress Loop and can easily
|
||||||
* once. This must not be used within the WordPress Loop.
|
* produce unexpected results. In most cases, the better option is to instead modify
|
||||||
|
* specific properties of the loop using the {@see 'pre_get_posts'} action.
|
||||||
|
*
|
||||||
|
* This must not be used within the WordPress Loop.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
* @global WP_Query $wp_query Global WP_Query instance.
|
* @global WP_Query $wp_query Global WP_Query instance.
|
||||||
*
|
*
|
||||||
* @param string $query
|
* @param array|string $query Array or string of WP_Query arguments.
|
||||||
* @return array List of posts
|
* @return array List of post objects.
|
||||||
*/
|
*/
|
||||||
function query_posts($query) {
|
function query_posts($query) {
|
||||||
$GLOBALS['wp_query'] = new WP_Query();
|
$GLOBALS['wp_query'] = new WP_Query();
|
||||||
|
|
Loading…
Reference in New Issue