WordPress core committer Jonny Harris merged a patch into WordPress core for a 12-year-old ticket that he says has the potential to bring “a massive effect on performance for custom pages.” The change, which will be included in the upcoming 6.0 release, stops unnecessary queries when developers are using the
do_parse_request filter, thanks to a refreshed patch from contributor Paul Bearne.
Harris summarized the problem and how the change improves performance in the commit message:
Developers of plugins and themes can use the
do_parse_request filter to hot-wire requests and hook in early to render custom pages. However, even through these request may not need post queries and 404 lookups to be run, they run anyway. This can results in unnecessary SQL queries running on these requests. By adding a return value to the
parse_request method of the
WP class, these queries can now be skipped.
WordPress core contributor Konstantin Kovshenin detailed the need for this change in a Twitter thread he published in 2021, when soliciting help for the ticket:
I don't usually tweet about #SEO, but this is important. Is a static robots.txt file good for WordPress performance? Let's find out!
To display the default robots.txt, a fresh WordPress install will: 🧵
Harris performed a quick review of plugins that use the filter and said he does not anticipate breakages. The search found 133 plugins using the filter. Some of the most popular ones include Google’s Site Kit plugin (1M+ installs), The Events Calendar (800K installs), and AMP (500K installs). Harris suggested the change requires a dev note, as it may have unanticipated side effects. The dev note is likely to be published closer to the time of release. WordPress 6.0 is currently scheduled for release on May 24, 2022.
Looks like it will be more interesting with WordPress 6.0. Can’t wait to use it.
Looks cool. Hope they soon will do a real performance makeover
I’ll take anything that boosts performance on a WP website, especially now with some plugins being almost necessary to have.
The Event Calendar doesn’t use this feature. They just mentioned it in their code comment.
Looking forward to seeing more tutorials using this filter.
20 minutes after upgrading to WP V6.0 my Google Lighthouse speed score dropped from 84 to 22 – I’ll give it a few more hours before I roll things back
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
WordPress Tavern is a website about all things WordPress. We cover news and events, write plugin and theme reviews, and talk about key issues within the WordPress ecosystem…
© All Rights Reserved. Powered by WordPress, hosted by Pressable