[wp-trac] [WordPress Trac] #42012: Do not switch roles and capabilities when accessing options through `*_blog_option()`

WordPress Trac noreply at wordpress.org
Wed Sep 27 21:51:34 UTC 2017


#42012: Do not switch roles and capabilities when accessing options through
`*_blog_option()`
--------------------------------+-----------------------------
 Reporter:  flixos90            |      Owner:
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:
 Severity:  normal              |   Keywords:  2nd-opinion
  Focuses:  multisite           |
--------------------------------+-----------------------------
 [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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42012>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list