WordPress.org

Make WordPress Core

Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#41815 closed defect (bug) (fixed)

switch_to_blog() docs incorrectly state that autoloaded options aren't switched

Reported by: jdgrimes Owned by: jeremyfelt
Milestone: 4.9 Priority: normal
Severity: normal Version: 3.5
Component: Cache API Keywords: good-first-bug has-patch
Focuses: docs, multisite Cc:

Description

The inline docs for switch_to_blog() include this:

 * Things that aren't switched:
 *  - autoloaded options. See #14992
 *  - plugins. See #14941

The statement that autoloaded options aren't switched was added to the docs in [15676], as suggested in 14992#comment:2. However, #14992 was later closed as worksforme, having been apparently fixed in the intervening time, via #21434 and other changes. The autoloaded options cache should now always be switched even when using a persistent caching plugin, since modern drop-ins should be implementing wp_cache_switch_to_blog().

As such, the statement that autoloaded options aren't switched doesn't appear to be accurate any longer, and should be removed. Or at the very least, it should be clarified to say that this is only a legacy issue with some persistent caching implementations.

Attachments (1)

41815.patch (443 bytes) - added by stevepuddick 23 months ago.
line removed

Download all attachments as: .zip

Change History (7)

#1 @jdgrimes
23 months ago

  • Keywords good-first-bug added

@stevepuddick
23 months ago

line removed

#2 @stevepuddick
23 months ago

  • Keywords has-patch added

Here it is. Created as part of virtual contrib2core workshop. https://www.meetup.com/The-Ottawa-WordPress-Group/events/242253849/

#3 @jeremyfelt
23 months ago

  • Milestone changed from Awaiting Review to 4.9
  • Owner set to jeremyfelt
  • Status changed from new to reviewing

Good catch, as of [21403], the blog ID was added to the cache key for multisite installs.

Thanks for the patch @stevepuddick!

#4 @jeremyfelt
23 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41373:

Multisite: Update docs for switch_to_blog().

As of [21403], autoload options are switched along with the cache key prefix.

Props stevepuddick.
Fixes #41815.

#6 @birgire
23 months ago

@pbearne great to see a video of the patch coding, thanks for sharing

Note: See TracTickets for help on using tickets.