The 4.6 release cycle has been a productive one! Several major and a few minor updates are described in detail below. If you’d like even more detail, here is a full list of multisite Used to describe a WordPress installation with a network of multiple blogs, grouped by sites. This installation type has shared users tables, and creates separate database tables for each blog (wp_posts becomes wp_0_posts). See also network, blog, site focused changes for 4.6.
Introduce WP_Site_Query and WP_Network_Query
WordPress 4.6 introduces
WP_Network_Query as well as their companion functions,
get_sites()), sites can now be queried from the
$wpdb->blogs table in a flexible way by id, domain, path, and more. For a full list of supported arguments, see the documentation attached to the
New filters and actions associated with this change include
Query results are cached as part of the global sites group. This will provide a performance boost for sites using a persistent object cache.
The introduction of this class helped resolve several long standing issues with
WP_MS_Sites_List_Table. Expect to see a faster and more relevant search when browsing through a network (versus site, blog)’s sites. See #36675.
For the background discussion around these changes, see #35791.
get_networks()), networks can now be queried from the
$wpdb->site table by id, domain, and path. Query results are cached as part of the global networks group. For a full list of supported arguments, see the documentation attached to the
WordPress core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. does not provide a UI User interface for managing multiple networks, but any sites using a plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party to do this will start to see a benefit from having this available.
New filters and actions associated with this change include
For the background discussion around these changes, see #32504.
Enhancements to WP_Site and WP_Network
New utility methods
get_network() have been introduced to retrieve a specific site or network respectively. They both accept either an ID, database object or class instance as the first parameter. If that parameter is omitted, the current site / network is returned.
Property changes on WP_Site and WP_Network
WP_Network objects now support access to their respective ID properties through property names which match current naming conventions. Furthermore, by accessing the properties with the new names, it is ensured that these are returned as integers rather than strings. The old properties are still accessible and valid, but these changes should encourage developers to use the new property names.
The following is the list of property improvements:
$site->id is the site’s ID. (previously
$site->network_id is the site’s parent network ID. (previously
$network->id is now an integer instead of a string.
$network->site_id is the network’s main site ID. (previously
For background discussion around these changes, see #36717 and #37050.
Lazy-loading extended properties
Additional properties of a site object normally accessed with
get_blog_details() are now automatically lazy-loaded when requested. This allows developers to use
get_site() as a replacement for
get_blog_details() which is likely to be deprecated in a future release. See #36935.
New Actions and Filters
Several new actions and filters were added as part of the
WP_Network_Query changes. Here are some others of note:
ms_loaded fires at the end of the multisite bootstrap process in
ms-settings.php. At this point the current site and network are available in the global scope. See #37235.
pre_get_blogs_of_user allows developers to alter or short-circuit the results of
get_blogs_of_user(), which can be an expensive function to run on configurations with many users. See #36707.
clean_site_cache fires after cache has been cleared with
clear_blog_cache(). This can be useful for clearing any custom cache keys associated with a site record. See #36203.
network_edit_site_nav_links filters the list of links displayed at the top of Edit Site views as a “tabbed” interface. See #15800.
ms_sites_list_table_query_args filters the arguments passed to
WP_Site_Query when building the MS Sites List Table. See #26580.
Other enhancements of note
get_current_network_id() as a helper function to find the current network’s ID. See #33900.
SUBDOMAIN_INSTALL constants can now be overridden in a project’s
wp-config.php when running unit tests. See #36567.
wp_get_sites() has been deprecated and
get_sites() should be used instead. Please note when making code changes that
get_sites() returns an array of
WP_Site objects where
wp_get_sites() returned an array of arrays.
WP Multi Network compatibility
The introduction of
get_networks() in 4.6 conflicts with the function of the same name in WP Multi Network, a plugin commonly used to provide multiple networks on a multisite installation. A fix for this is already in the master branch A directory in Subversion. WordPress uses branches to store the latest development code for each major release (3.9, 4.0, etc.). Branches are then updated with code for any minor releases of that branch. Sometimes, a major version of WordPress and its minor versions are collectively referred to as a "branch", such as "the 4.0 branch". of the plugin, and will be included in the next release. In the same change, many other functions were wrapped in
function_exists() calls to prevent similar conflicts in the future. If you are using WP Multi Network, please be sure to update accordingly.