Make WordPress Core


Ignore:
Timestamp:
04/29/2022 12:34:35 PM (4 years ago)
Author:
spacedmonkey
Message:

Taxonomy: Increase cache hits in WP_Term_Query when using include and exclude parameters.

Ensure that empty values of include and exclude passed to the parameters of WP_Term_Query, reused existing caches by
resetting values to an empty array.

Props Spacedmonkey, peterwilsoncc, hellofromtonya.
Follow-up to [52970].
See #55352.

File:
1 edited

Legend:

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

    r53302 r53309  
    458458                }
    459459
     460                if ( empty( $args['exclude'] ) ) {
     461                        $args['exclude'] = array();
     462                }
     463
     464                if ( empty( $args['include'] ) ) {
     465                        $args['include'] = array();
     466                }
     467
    460468                $exclude      = $args['exclude'];
    461469                $exclude_tree = $args['exclude_tree'];
Note: See TracChangeset for help on using the changeset viewer.