[wp-trac] [WordPress Trac] #55270: Option can_compress_scripts not autoload causing extra DB query on every request
WordPress Trac
noreply at wordpress.org
Sun Feb 27 13:57:07 UTC 2022
#55270: Option can_compress_scripts not autoload causing extra DB query on every
request
---------------------------+-----------------------------
Reporter: RavanH | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: trunk
Severity: minor | Keywords:
Focuses: |
---------------------------+-----------------------------
Asked about this two years ago https://wordpress.org/support/topic/option-
can_compress_scripts-not-autoload/ but noticed this is still the case:
The option can_compress_scripts not being among the autoload options
creates an extra DB query on **every** (front-end and admin) request:
{{{
SELECT option_value FROM wp_options WHERE option_name =
'can_compress_scripts' LIMIT 1
}}}
Install Debug Bar and you'll notice it everywhere.
WordPress can very easily prevent this extra query (for one option!) by
making it an autoload option by putting it into the array of $defaults in
populate_options() in wp-admin/includes/schema.php and removing it from
the $unusedoptions array...
Next, an upgrade routine to make it autoload for current sites on
upgrade... And maybe rethink the Network approach: currently stored as a
network option, but is it really a network option? It gets updated on
every odd sub-site admin (not super-admin!) request via compression_test()
in admin-footer.php anyway so why not make it a normal blog option?
Note that it has been in the $unusedoptions array since WordPress 1.5 but
re-introduced as an actively used DB option in 2.8 in script-loader.php
and admin-footer.php.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55270>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list