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.

Built from https://develop.svn.wordpress.org/trunk@37877


git-svn-id: http://core.svn.wordpress.org/trunk@37818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2016-06-26 17:47:28 +00:00
parent 94980d89e0
commit 872f1c5d38
2 changed files with 9 additions and 6 deletions

View File

@ -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();

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-alpha-37876'; $wp_version = '4.6-alpha-37877';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.