WordPress 6.0 to Introduce Performance Improvements for Custom Pages
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_requestfilter 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_requestmethod of the
WPclass, 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:
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.