[wp-trac] [WordPress Trac] #63284: _prime_post_caches is getting called unchunked
WordPress Trac
noreply at wordpress.org
Wed Apr 16 00:18:22 UTC 2025
#63284: _prime_post_caches is getting called unchunked
--------------------------+------------------------------
Reporter: ckeeney | Owner: joemcgill
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.7.2
Severity: major | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by peterwilsoncc):
It looks like the difference is from a clause in WP_Query that determines
whether the query [https://github.com/WordPress/wordpress-
develop/blob/d44e1c2ce2dc638e89ed6a1d02b1cfadb8a15fe7/src/wp-includes
/class-wp-query.php#L3362-L3368 should be split], ie whether WP should
query the post IDs only before calling `_prime_post_caches()`
Without an object cache, `WP_Query` doesn't split the query so queries all
the post objects (in my example above, 1000 posts). `WP_Query` then primes
the cache with this data directly via `update_post_caches()`
([https://github.com/WordPress/wordpress-
develop/blob/d44e1c2ce2dc638e89ed6a1d02b1cfadb8a15fe7/src/wp-includes
/class-wp-query.php#L3635 code ref]).
With an object cache, `WP_Query` does split the query and subsequently
calls `_prime_post_caches()`.
So in both cases, a large number of posts are queried and primed but it
happens using a slightly different code path.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63284#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list