Performance improvements in WordPress 6.1: enhanced database peformance and more
WordPress 6.1 – the last major release of 2022 – is finally here! This release is a step in the right direction for full-site editing, bringing various customization options and improvements to the content creation and site creation experience. We’ve covered some notable changes in this update, which you can check out here. This post is dedicated to exploring the performance enhancements coming to our favorite open-source platform.
WordPress 6.1 is the collective effort of a massive team of developers and contributors. Jean Baptiste Audras – the Triage team lead – shared some amazing statistics about the contributions to this release. An impressive 800 people from at least 60 countries and 180 identified companies contributed to WordPress 6.1.
At Yoast, we’re proud of the work we’ve put into making this release possible. Out of all companies that contributed to 6.1, Yoast takes the number 2 spot with 740 contributions made by 16 contributors. Sergey Biryukov – a member of our dedicated team of WordPress contributors – tops the list with a whopping 584 contributions! Not to mention Bluehost – a fellow company in Newfold Digital – also contributed greatly to this release with 150 contributions.
The WordPress Core Performance Team has done some incredible work to make the platform faster in the 6.1 release. This team, comprising members from Google, 10up, XWP, and Yoast, was formed in 2021 to monitor, enhance, and promote performance in WordPress core and its surrounding ecosystem. Without them, these improvements wouldn’t have been possible.
Performance improvements are always welcomed by the community. We all know the importance of good website performance for SEO – a fast site is more favorable to rank high in the SERP. That’s due to Google and other search engines rewarding sites that deliver a fast and smooth user experience. Of course, you need good content to rank. But among many quality results, any small performance improvements may prove to be significant.
Let’s dive into some of the notable performance enhancements in WordPress 6.1!
Huge improvements to WP_Query with caching additions
The addition of caching to WP_Query is one of the most significant performance improvements in WordPress 6.1. Basically, every time a visitor requests a web page, their browser has to make a request to the web server asking for information. The server needs to respond to this request and retrieve data from a database (or multiple ones) to send back. By implementing caching to WP_Query
, the next time another visitor requests that same page, the page’s data would be retrieved from the website’s cache instead of retrieving data directly from the database.
These changes aim to reduce the number of database queries and make sites faster, especially when using persistent object caching like Redis or Memcached. That’s because the database query will not run again until caches are invalidated. With fewer database queries, your pages will load faster, thus providing a better user experience for visitors.
This is a much anticipated and welcomed improvement for many, especially developers. Jonny Harris – the contributor who worked on this improvement – shared his excitement in a recent Tweet.
Improvements to the REST API
Another significant performance boost comes with improvements to the REST API. In short, these updates decrease the number of database queries that run on each REST API request, allowing your pages to load faster.
For instance, WordPress introduces an improvement of the post controller in the REST API. When returning a post in a REST API response, the post controller would request linked data such as author, featured image, and text. Since these linked items are not primed (ready for use) in caches, it might mean that for each post in the REST API response, there would be data queries from separate databases: one for the author, one for the featured image, and another for the text.
Instead, in WordPress 6.1, all the caches are primed in a single database query. That means that the post controller in the REST API can grab data from that single database query instead of requesting data from separate databases, resulting in fewer queries.
Improvements to the Cache API
The Cache API gets various improvements in this release. Most notably, several private cache priming functions are available for public use in this release. WordPress encourages plugin and theme authors to use these functions to improve the performance of their code by reducing the number of database queries, which improves the website’s load speed.
Media improvements
WordPress 6.1 will automatically add decoding="async"
to image attributes. In simple terms, this function tells your visitor’s browser that it’s okay to load images a bit later in favor of other information and data. This results in the page loading the content much faster and also reduces page render time. This is a huge performance booster for any web page containing a lot of images. It’s also good to know that you can remove this function.
Site health improvements
WordPress 6.1 introduces two new Site Health checks for Persistent Object Cache and Page Cache.
- Persistent Object Cache – This new check determines whether the site uses a persistent object cache or not and recommends it if it makes sense for the site. It also links to a support resource created for the check. A few filters have been included for hosting providers to provide more specific steps regarding their environment.
- Full Page Cache – This new check determines whether the site is using a full page cache solution and if the response time is acceptable. It also adds a couple of filters for hosting companies to customize the response threshold and add their own cache headers to be detected.
Improved compatibility with PHP 8x
WordPress 6.1 receives important compatibility improvements with PHP 8.0 and 8.1. All of this is possible thanks to the incredible work of many developers, especially Juliette Reinders Folmer. A few of us Yoasters also contributed to this effort, namely Sergey Biryukov, Carolina, and Ari Stathopoulos!
The 6.1 release has continued the code modernization efforts on updating WordPress core and unit test suite for PHP 8.0 and 8.1, as well as preparing for PHP 8.2. Version 8.2 of PHP is expected to be released on November 24, 2022. We can expect some significant changes coming in PHP 8.2, which could impact many themes and plugins.
The big step forward in this release is that WordPress core unit tests now pass on PHP 8.1 and 8.2. While full compatibility with PHP 8.1 and 8.2 is still a work in progress, this should prevent new PHP issues from being introduced in WordPress core. All remaining known issues are deprecation notices.
It’s good to note that a deprecation notice is not an error, but rather an indicator of where additional work is needed for compatibility before PHP 9 (i.e. when the notices become fatal errors). With a deprecation notice, the PHP code will continue to work and nothing is broken.
Changes to the loading routine
As of WordPress 6.1, the send_headers
hook has been moved to slightly later in the WordPress loading routine. This is a ticket that our Sergey Biryukov worked on!
When you request a page, the web server needs to send back some headers
that contain technical information about the page like response status. This lacks flexibility because some functions wouldn’t work when headers
are being sent. By moving send_headers
to after WordPress parses the query, those functions now work properly. This change may affect plugin developers, making it easier for them to manage header
.
Performance enhancements in the editor
Some optimizations were made to the block editor to avoid repetitive calls to filesystem and processing of block.json
files. These changes should improve loading performance and benefit all WordPress sites. Ari Stathopoulos – another member of our WordPress core contributor team – was responsible for making this happen!
Want to try out more performance improvements?
The WordPress Core Performance team has created the Performance Lab plugin to give users early access to new performance modules they’re working on. Install it and you’ll be able to try out their latest developments yourself, see how they impact your site’s performance and share any feedback you have. If you’d like to be even more involved, you can also help out as a contributor! And if you’re interested in finding out more about the performance improvements in 6.1, don’t forget to check out this Performance Field Guide thread. It contains loads of useful information for developers!
Coming up next!
-
Event
WordCamp Netherlands 2024
November 29 - 30, 2024 Team Yoast is at Sponsoring WordCamp Netherlands 2024! Click through to see who will be there, what we will do, and more! See where you can find us next » -
SEO webinar
The SEO update by Yoast - October & November 2024 Edition
26 November 2024 Get expert analysis on the latest SEO news developments with Carolyn Shelby and Alex Moss. Join our upcoming update! 📺️ All Yoast SEO webinars »