[wp-trac] [WordPress Trac] #58001: Lazy load user capabilities in WP_User object
WordPress Trac
noreply at wordpress.org
Wed Oct 8 19:59:45 UTC 2025
#58001: Lazy load user capabilities in WP_User object
--------------------------------------------+------------------------------
Reporter: spacedmonkey | Owner: flixos90
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.9
Component: Users | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests early | Focuses: multisite,
| performance
--------------------------------------------+------------------------------
Changes (by spacedmonkey):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"60915" 60915]:
{{{
#!CommitTicketReference repository="" revision="60915"
Users: Lazy load user capabilities in WP_User object.
Convert the WP_User object properties caps, roles, and allcaps to
protected, and introduce lazy loading for capabilities. These properties
are now populated only when first accessed.
The existing magic methods (__get, __set, and __unset) have been updated
to maintain backward compatibility, ensuring that reading or modifying
these formerly public properties continues to work as expected.
Ensure that these properties are initialised when calling
remove_all_caps(), remove_cap(), has_cap(), add_role(), and set_role()
methods.
Props spacedmonkey, flixos90, peterwilsoncc, mukesh27, westonruter,
swissspidy, prettyboymp.
Fixes #58001.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58001#comment:38>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list