<div style="text-align:center"><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==" fifu-lazy="1" fifu-data-sizes="auto" fifu-data-srcset="https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=75&resize=75&ssl=1 75w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=100&resize=100&ssl=1 100w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=150&resize=150&ssl=1 150w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=240&resize=240&ssl=1 240w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=320&resize=320&ssl=1 320w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=500&resize=500&ssl=1 500w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=640&resize=640&ssl=1 640w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=800&resize=800&ssl=1 800w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=1024&resize=1024&ssl=1 1024w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=1280&resize=1280&ssl=1 1280w, https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1&w=1600&resize=1600&ssl=1 1600w" width="1460" height="730" fifu-data-src="https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Multisite improvements in WordPress 6.1" title="Multisite improvements in WordPress 6.1" srcset="https://i1.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1.jpg?ssl=1 1460w, https://www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1-300x150.jpg 300w, https://www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1-1024x512.jpg 1024w, https://www.awordpresscommenter.com/wp-content/uploads/2022/10/multisite-improvements-in-wordpress-6-1-768x384.jpg 768w" sizes="(max-width: 1460px) 100vw, 1460px" /></div><div>
<h2>Using the metadata API for network options</h2>
<p>The way that network options are accessed is changing in WordPress 6.1. Network options have always been stored in a <code>meta</code> table called <code>sitemeta</code>. This name is confusing, as “site” in this context means “network,” not to be confused with blog <code>meta</code>, used to store site metadata. Prior to WordPress 6.1, the functions <code>get_network_option</code>, <code>add_network_option</code>, <code>update_network_options</code>, and <code>delete_network_option</code> used custom database queries and caching. This resulted in some performance issues and lots of code to maintain. </p>
<p>In WordPress 6.1, the network options functions have been updated to use the more established metadata API, which is already used for metadata of other object types like posts, terms, and users. This effectively makes a function like <code>get_network_option</code> a wrapper around <code>get_metadata</code>. This has a number of advantages including:</p>
<ul>
<li>Consistency with other metadata types</li>
<li>Support for <code>register_meta</code> functionality, such as default values</li>
<li>Improved cache priming </li>
<li>Fewer database queries, as all network options are primed in a single request </li>
</ul>
<p>Along with these improvements, <code>WP_Network_Query</code> has a new parameter called <code>update_network_meta_cache</code> that allows for all networks in the query to prime the network options in a single query. </p>
<p>One side effect of this change is that newly updated network options using an integer value may result in a string being returned. When using values like this with an integer comparison, it is important to allow cast to an int. In the old implementation, the second page load of the option would have resulted in returning a string. This change can be considered a fix but it is different from the current behavior. </p>
<p>This change makes cache group <code>site-options</code> no longer in use and a candidate to be removed in future releases. </p>
<p>For more information, visit Trac ticket <a href="https://core.trac.wordpress.org/ticket/37181">#37181</a>. </p>
<h2>Store main site ID of network in network options</h2>
<p>When a multisite is created in WordPress 6.1, the main site ID on the network is stored in network options. As the main site on the network does not change in most cases, this is a value that can be stored for future reference. This saves a call to <code>WP_Site_Query</code> to look up the main site by domain and path in the bootstrap process which makes This lookup wasteful and not needed. This change also helps setup multiple networks, as noted above, since network options are primed in a single request. This means that when looking up multiple networks, the main site ID is now primed in along with other network options, resulting in fewer database queries / cache lookups. </p>
<p>For more information, visit Trac ticket <a href="https://core.trac.wordpress.org/ticket/55802">#55802</a>. </p>
<p class="has-text-align-right"><em>Thanks to @flixos90 and @milana_cap for peer review, and <a href="https://profiles.wordpress.org/shetheliving/" class="mention"><span class="mentions-prefix">@</span>shetheliving</a> and <a href="https://profiles.wordpress.org/webcommsat/" class="mention"><span class="mentions-prefix">@</span>webcommsat</a> for proofreading.</em></p>
<p class="o2-appended-tags"><a href="https://make.wordpress.org/core/tag/6-1/" class="tag"><span class="tag-prefix">#</span>6-1</a>, <a href="https://make.wordpress.org/core/tag/core-multisite/" class="tag"><span class="tag-prefix">#</span>core-multisite</a>, <a href="https://make.wordpress.org/core/tag/dev-notes/" class="tag"><span class="tag-prefix">#</span>dev-notes</a>, <a href="https://make.wordpress.org/core/tag/dev-notes-6-1/" class="tag"><span class="tag-prefix">#</span>dev-notes-6-1</a>, <a href="https://make.wordpress.org/core/tag/multisite/" class="tag"><span class="tag-prefix">#</span>multisite</a>, <a href="https://make.wordpress.org/core/tag/performance/" class="tag"><span class="tag-prefix">#</span>performance</a></p>
</div>

A U.S. magistrate judge has moved to rein in the escalating discovery battle between WP…
Ollie’s “game-changing” Menu Designer plugin is moving toward inclusion in WordPress core. Anne McCarthy says…
WordPress.com has rolled out support for the Model Context Protocol (MCP), allowing AI assistants to…
Ten hosting providers have been certified under the Secure Hosting Alliance’s new Trust Seal program,…
When WP Accessibility Day kicks off next week, someone, somewhere will always be awake. As…
The full chat log is available beginning here on Slack. WordPress Performance Trac tickets @westonruter…