[wp-trac] [WordPress Trac] #39242: Add caching to count_user_posts()
WordPress Trac
noreply at wordpress.org
Tue Feb 4 00:09:45 UTC 2025
#39242: Add caching to count_user_posts()
-------------------------------------------------+-------------------------
Reporter: johnjamesjacoby | Owner: whyisjake
Type: enhancement | Status: accepted
Priority: normal | Milestone: 6.8
Component: Users | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch dev-feedback needs- | Focuses: rest-api,
testing has-unit-tests | performance
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):
* milestone: Future Release => 6.8
Comment:
I've approved the [https://github.com/WordPress/wordpress-
develop/pull/8233 linked pull request #8233] for commit.
I'm happy it addresses the issues highlighted earlier as it uses a hash of
the SQL query to generate the cache key and includes the posts' `last-
changed` value to break the cache as authors are potentially reassigned or
posts marked private.
I've confirmed that the users' `last-changed` value isn't needed as the
function doesn't take in to account whether or not the user ID exists.
Strange but true. When a user is deleted and their posts reassigned the
post `last-change` value is bumped.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39242#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list