WordPress.org

Make WordPress Core

Ticket #35791: get_sites_by_path_patch.diff

File get_sites_by_path_patch.diff, 830 bytes (added by spacedmonkey, 3 years ago)
  • src/wp-includes/ms-load.php

     
    239239                'number' => 1,
    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';
    251244        }
    252245
     246        if ( count( $paths ) > 1 ) {
     247                $args['orderby']['path_length'] = 'DESC';
     248        }
     249
    253250        $result = get_sites( $args );
    254251        $site = array_shift( $result );
    255252