[wp-trac] [WordPress Trac] #55270: Option can_compress_scripts not autoload causing extra DB query on every request

WordPress Trac noreply at wordpress.org
Mon Jun 5 11:22:19 UTC 2023


#55270: Option can_compress_scripts not autoload causing extra DB query on every
request
--------------------------------+---------------------------
 Reporter:  RavanH              |       Owner:  spacedmonkey
     Type:  defect (bug)        |      Status:  reopened
 Priority:  normal              |   Milestone:  6.3
Component:  Options, Meta APIs  |     Version:
 Severity:  minor               |  Resolution:
 Keywords:  needs-patch         |     Focuses:  performance
--------------------------------+---------------------------

Comment (by spacedmonkey):

 Before this change, `update_site_option` was called even on single site.
 If the option does exist, like on the first run, it falls back to
 `add_network_option` and then `$result = add_option( $option, $value, '',
 'no' );`. This is why the change was made to use `update_option(
 'can_compress_scripts', 0, 'yes' )`, on the first run of this code,
 `update_option` falls back to `add_option`. Adding autoload = yes, might
 be overkill, it is helpful, as it makes the point of this code much
 clearer.

 The commit works as expected in my testing. Can you give me steps to
 replicate a bug and I can see if I work on a fix.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55270#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list