[wp-trac] [WordPress Trac] #58964: Introduce dedicated function to set autoload value of an option already in the database

WordPress Trac noreply at wordpress.org
Wed Aug 2 23:14:19 UTC 2023


#58964: Introduce dedicated function to set autoload value of an option already in
the database
--------------------------------+------------------------------
 Reporter:  flixos90            |       Owner:  (none)
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:  performance
--------------------------------+------------------------------

Comment (by flixos90):

 Thanks @SergeyBiryukov, great pointer!

 I like the proposal on that ticket, I would actually propose that they
 should coexist though, and #48393 should use what's proposed here: I think
 implementing a single-purpose function to update the autoload value
 provides most flexibility, and then `update_option()` could use that
 function internally if the value of the option matches but the autoload
 value does not.

 The function here would still offer support for additional use-cases, for
 example: A plugin could implement logic in their deactivation hook that
 sets all its options to `autoload=no`, and then logic in the activation
 hook to reconfigure the autoload value to be as intended.

 WDYT?

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


More information about the wp-trac mailing list