WordPress.org

Make WordPress Core

Changeset 37877


Ignore:
Timestamp:
06/26/2016 05:46:10 PM (3 years ago)
Author:
DrewAPicture
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r37862 r37877  
    7878
    7979/**
    80  * Set up The Loop with query parameters.
    81  *
    82  * This will override the current WordPress Loop and shouldn't be used more than
    83  * once. This must not be used within the WordPress Loop.
     80 * Sets up The Loop with query parameters.
     81 *
     82 * Important: This will completely override the current WordPress Loop and can easily
     83 * produce unexpected results. In most cases, the better option is to instead modify
     84 * specific properties of the loop using the {@see 'pre_get_posts'} action.
     85 *
     86 * This must not be used within the WordPress Loop.
    8487 *
    8588 * @since 1.5.0
     
    8790 * @global WP_Query $wp_query Global WP_Query instance.
    8891 *
    89  * @param string $query
    90  * @return array List of posts
     92 * @param array|string $query Array or string of WP_Query arguments.
     93 * @return array List of post objects.
    9194 */
    9295function query_posts($query) {
Note: See TracChangeset for help on using the changeset viewer.