Make WordPress Core

Changeset 37930


Ignore:
Timestamp:
06/30/2016 04:58:06 PM (8 years ago)
Author:
jeremyfelt
Message:

Multisite: Simplify logic assigning orderby in get_site_by_path().

Before [37628], there were 3 separate conditions for ordering by domain and/or path in get_site_by_path() that each resulted in it's own query. Now that get_sites() is used and supports WP_Site_Query, this can be simplified.

Props spacedmonkey.
Fixes #37215.

File:
1 edited

Legend:

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

    r37896 r37930  
    240240    );
    241241
    242     if ( count( $domains ) > 1 && count( $paths ) > 1 ) {
    243         $args['orderby'] = 'domain_length path_length';
    244         $args['order'] = 'DESC DESC';
    245     } elseif ( count( $domains ) > 1 ) {
    246         $args['orderby'] = 'domain_length';
    247         $args['order'] = 'DESC';
    248     } elseif ( count( $paths ) > 1 ) {
    249         $args['orderby'] = 'path_length';
    250         $args['order'] = 'DESC';
     242    if ( count( $domains ) > 1 ) {
     243        $args['orderby']['domain_length'] = 'DESC';
     244    }
     245
     246    if ( count( $paths ) > 1 ) {
     247        $args['orderby']['path_length'] = 'DESC';
    251248    }
    252249
Note: See TracChangeset for help on using the changeset viewer.