Make WordPress Core


Ignore:
Timestamp:
02/05/2015 07:37:47 PM (10 years ago)
Author:
boonebgorges
Message:

Modify `meta_query orderby syntax to use array keys as clause "handles".

The implementation of meta_query orderby introduced in [31312] put clause
identifiers into a 'name' parameter of the clause. For greater clarity, this
changeset updates the syntax to use the associative array key used when
defining meta_query parameters, instead of the 'name' parameter.

Props Funkatronic, DrewAPicture.
Fixes #31045.

File:
1 edited

Legend:

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

    r31324 r31340  
    14511451     *
    14521452     * @since 1.5.0
     1453     * @since 4.2.0 Introduced the ability to order by specific clauses of a `$meta_query`, by passing the clause's
     1454     *              array key to `$orderby`.
    14531455     * @access public
    14541456     *
     
    14981500     *     @type string       $order                   Designates ascending or descending order of posts. Default 'DESC'.
    14991501     *                                                 Accepts 'ASC', 'DESC'.
    1500      *     @type string       $orderby                 Sort retrieved posts by parameter. One or more options can be
     1502     *     @type string|array $orderby                 Sort retrieved posts by parameter. One or more options may be
    15011503     *                                                 passed. To use 'meta_value', or 'meta_value_num',
    1502      *                                                 'meta_key=keyname' must be also be defined. Default 'date'.
    1503      *                                                 Accepts 'none', 'name', 'author', 'date', 'title', 'modified',
    1504      *                                                 'menu_order', 'parent', 'ID', 'rand', 'comment_count'.
     1504     *                                                 'meta_key=keyname' must be also be defined. To sort by a
     1505     *                                                 specific `$meta_query` clause, use that clause's array key.
     1506     *                                                 Default 'date'. Accepts 'none', 'name', 'author', 'date',
     1507     *                                                 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand',
     1508     *                                                 'comment_count', 'meta_value', 'meta_value_num', and the
     1509     *                                                 array keys of `$meta_query`.
    15051510     *     @type int          $p                       Post ID.
    15061511     *     @type int          $page                    Show the number of posts that would show up on page X of a
Note: See TracChangeset for help on using the changeset viewer.