WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/20/2017 10:45:29 PM (3 years ago)
Author:
boonebgorges
Message:

Improve data types returned from empty hierarchical term queries.

When querying for 'count', ensure that 0 is returned. Otherwise,
ensure that it's an array.

Props xParham, birgire.
Fixes #42327.

File:
1 edited

Legend:

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

    r41881 r42209  
    380380
    381381            if ( ! $in_hierarchy ) {
    382                 return array();
     382                if ( 'count' == $args['fields'] ) {
     383                    return 0;
     384                } else {
     385                    $this->terms = array();
     386                    return $this->terms;
     387                }
    383388            }
    384389        }
Note: See TracChangeset for help on using the changeset viewer.