Multisite Focused Changes in 4.5

Howdy! The 4.5 release cycle was relatively quiet for multisite, though we still managed to knock out a few good things. The following is a brief rundown of each, full details can be found in the full list of multisite focused changes for 4.5. 💫

Introduce WP_Site

The global $current_blog has always been used as a way to store the properties in a stdClass object of the current site during bootstrap. With the introduction of WP_Site, we add some definition and have a more proper object to pass around. Sweet.

Take a look at ms-settings.php if you are using a custom sunrise.php to populate the $current_blog global. We now create a WP_Site object from the existing $current_blog if it has been populated elsewhere. This is a backward compatible change, though should be tested wherever your code interacts with $current_blog, especially if anything has been done to extend its structure.

This last paragraph may sound familiar to you because I copied it from the notes on the work we did in the 4.4 release to add WP_Network as an object. In future releases, we’ll continue to build these out with query classes as well.

See #32450 for all the details.

New Actions and Filters

  • network_user_new_form fires at the end of the network’s Add New User form. #15389
  • network_site_new_form fires at the end of the network’s Add New Site form. #34739
  • network_allowed_themes and site_allowed_themes allow for more granular filtering of the themes allowed for a site. The legacy allowed_themes will continue to do its job. #28436
  • pre_network_site_pre_created_user fires right before a new user is created during the Add New Site process if one does not already exist. #33631

Other interesting things

  • Use a usermeta key rather than a site option keyed to the user ID when a user changes their email address and confirmation is needed. #23358
  • In subdomain installations, if a user attempted to login to a site they did not have access to on the network, they would be shown an access denied message with a list of authorized sites. This differed from the behavior in subdirectory installs, where the user would be redirected to either their profile page or the dashboard of their primary site. In 4.5, the subdomain behavior now matches the subdirectory behavior. #30598
  • The performance of wp_upload_dir() has been improved, specifically via persistent cache. This isn’t necessarily multisite related, though you should probably be familiar with the change. #34359
  • Show the home URL rather than siteurl in site-info.php and use the text “Site Address (URL)” for consistency with the similar site in single site. #35632
  • Provide an “Edit user” link after adding a new user to a site or network. #35705 😻

And that’s about it. There may still be some bug fixing in the next week or so, but only if you get out there and test trunk against your plugins, themes, and crazy configurations. Have at it!

#4-5, #dev-notes, #multisite