WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/23/2014 03:51:24 AM (7 years ago)
Author:
wonderboymusic
Message:

Ordering by RAND():

The shortcode callbacks for gallery and playlist check for 'RAND' == $atts['order'], which isn't a valid value for order. Remove those checks and update the docs.

In WP_Query, if the value of orderby is rand, order is irrelevant and should be unset.

Adds unit tests.

Fixes #29629.

File:
1 edited

Legend:

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

    r29750 r29760  
    960960
    961961    $id = intval( $atts['id'] );
    962     if ( 'RAND' == $atts['order'] ) {
    963         $atts['orderby'] = 'none';
    964     }
    965962
    966963    if ( ! empty( $atts['include'] ) ) {
     
    11671164 *     @type string  $type         Type of playlist to display. Accepts 'audio' or 'video'. Default 'audio'.
    11681165 *     @type string  $order        Designates ascending or descending order of items in the playlist.
    1169  *                                 Accepts 'ASC', 'DESC', or 'RAND'. Default 'ASC'.
     1166 *                                 Accepts 'ASC', 'DESC'. Default 'ASC'.
    11701167 *     @type string  $orderby      Any column, or columns, to sort the playlist. If $ids are
    11711168 *                                 passed, this defaults to the order of the $ids array ('post__in').
     
    12441241
    12451242    $id = intval( $atts['id'] );
    1246     if ( 'RAND' == $atts['order'] ) {
    1247         $atts['orderby'] = 'none';
    1248     }
    12491243
    12501244    $args = array(
Note: See TracChangeset for help on using the changeset viewer.