WordPress.org

Make WordPress Core

Ticket #21887: 21887.patch

File 21887.patch, 916 bytes (added by SergeyBiryukov, 3 years ago)
  • wp-includes/taxonomy.php

     
    13421342                $where .= ' AND tt.count > 0'; 
    13431343 
    13441344        // don't limit the query results when we have to descend the family tree 
    1345         if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' === $parent ) { 
     1345        if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) { 
    13461346                if ( $offset ) 
    13471347                        $limits = 'LIMIT ' . $offset . ',' . $number; 
    13481348                else 
     
    14471447                $terms = $_terms; 
    14481448        } 
    14491449 
    1450         if ( 0 < $number && intval(@count($terms)) > $number ) { 
    1451                 $terms = array_slice($terms, $offset, $number); 
    1452         } 
     1450        if ( $number && is_array( $terms ) && count( $terms ) > $number ) 
     1451                $terms = array_slice( $terms, $offset, $number ); 
    14531452 
    14541453        wp_cache_add( $cache_key, $terms, 'terms', 86400 ); // one day 
    14551454