[wp-trac] [WordPress Trac] #55352: Improve cache key generation in WP_Term_Query
WordPress Trac
noreply at wordpress.org
Mon Mar 21 11:52:56 UTC 2022
#55352: Improve cache key generation in WP_Term_Query
--------------------------------------+---------------------------
Reporter: spacedmonkey | Owner: spacedmonkey
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.0
Component: Taxonomy | Version: 4.7
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+---------------------------
Comment (by SergeyBiryukov):
Lines like this seem a bit too hard to read for me without spending some
time to parse the logic:
{{{
$args['term_taxonomy_id'] = is_string( $args['term_taxonomy_id'] ) && 0
=== strlen( $args['term_taxonomy_id'] ) ? array() : array_map( 'intval',
(array) $args['term_taxonomy_id'] );
}}}
I think this can be simplified to:
{{{
if ( '' === $args['term_taxonomy_id'] ) {
$args['term_taxonomy_id'] = array();
} else {
$args['term_taxonomy_id'] = array_map( 'intval', (array)
$args['term_taxonomy_id'] );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55352#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list