From 872f1c5d38c73a5a655592cac37ac9945805a4ad Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sun, 26 Jun 2016 17:47:28 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 13 ++++++++----- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 96d47902b8..35662468f0 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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 - * once. This must not be used within the WordPress Loop. + * Important: This will completely override the current WordPress Loop and can easily + * 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 * * @global WP_Query $wp_query Global WP_Query instance. * - * @param string $query - * @return array List of posts + * @param array|string $query Array or string of WP_Query arguments. + * @return array List of post objects. */ function query_posts($query) { $GLOBALS['wp_query'] = new WP_Query(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 08c82d4956..ae2f072a3c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.