Make WordPress Core

Opened 7 years ago

Last modified 3 years ago

#42012 new enhancement

Do not switch roles and capabilities when accessing options through `*_blog_option()`

Reported by: flixos90's profile flixos90 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: 2nd-opinion
Focuses: multisite Cc:


[41625] has outsourced the functionality to switch the current user's capabilities and available roles when sites are being switched, instead this now happens in wp_switch_roles_and_user() which is hooked into the switch_blog action.

When accessing get_blog_option(), add_blog_option(), update_blog_option() or delete_blog_option(), it should be safe to always unhook the function temporarily (see WP_Roles::get_roles_data() for an example where it already happens manually in core) to improve performance, in some cases significantly. Roles and capabilities are not needed when accessing options, however we need to be careful and think about what plugins are possibly doing here.

Let's discuss whether this can happen automatically in core or whether it should be left to developers.

Change History (0)

Note: See TracTickets for help on using tickets.