[wp-trac] [WordPress Trac] #55837: WP_Term_Query cache problem
WordPress Trac
noreply at wordpress.org
Sat May 28 03:22:12 UTC 2022
#55837: WP_Term_Query cache problem
----------------------------------------+---------------------
Reporter: denishua | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.0.1
Component: Taxonomy | Version: 6.0
Severity: normal | Resolution:
Keywords: needs-unit-tests has-patch | Focuses:
----------------------------------------+---------------------
Comment (by denishua):
I think is better to cache after get $terms
{{{#!php
<?php
$terms = $wpdb->get_results( $this->request );
}}}
otherwise if $args['pad_counts'] is true and it is set $args['number'].
the pad_counts of term will be different before cache and get from cache.
Replying to [comment:5 spacedmonkey]:
> Thanks for the ping @peterwilsoncc !
>
> I have put together a patch. This does a number of things.
>
> - Fixes the core issue, that was highlighted here.
> - Removes confusing and unneeded code.
> - Improves the cache value, so it now only stores an array of ids, in
all but two caches ( count and object with ids ).
>
> This will also improve memory usage on every page, which is another side
benefit.
> Once someone has proved that this fixes the issue, I will add some unit
tests.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55837#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list