[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
Thu Aug 24 19:23: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:  6.4
Component:  Options, Meta APIs        |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------

Comment (by boonebgorges):

 Thanks for the ping @flixos90 ! It was definitely an oversight in [31640]
 that `autoload` would not be updated if the option value was unchanged, so
 I'm very much in favor of correcting that behavior.

 Introducing separate functions for this purpose seems OK to me.

 Your PR doesn't make the necessary changes to `update_option()`, as you
 note in https://core.trac.wordpress.org/ticket/58964#comment:11. I'm not
 certain about the best way to implement this without messing with the
 `return` semantics of `update_option()`. Currently we return `false` if
 the new value is the same as the old. But on the proposal,
 `update_option()` would update the value if only `autoload` changed, which
 means we either have to (a) return `true`, which is a sort of change in
 behavior, or (b) return `false`, which is semantically incorrect.

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


More information about the wp-trac mailing list