[wp-trac] [WordPress Trac] #56548: Introduce `get_option` action

WordPress Trac noreply at wordpress.org
Sun Sep 11 19:00:11 UTC 2022


#56548: Introduce `get_option` action
-------------------------+-------------------------------------------------
 Reporter:  flixos90     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Options,     |    Version:
  Meta APIs              |   Keywords:  needs-patch 2nd-opinion needs-unit-
 Severity:  normal       |  tests
  Focuses:               |
-------------------------+-------------------------------------------------
 There has been the `option_{$option}` filter for a long time, and it makes
 sense that this filter should be used to tweak options when reading them.

 However, there is sometimes a need for running certain logic for when an
 option is being read. For example, the WordPress performance team is
 currently working on a feature to optimize the autoloaded options list.

 For such purposes, we would like to add a new `get_option` action:
 * The reasoning for making it an action is to not falsely encourage
 developers to think they could use this to filter an option value (which
 would be excessive since it would be running for every option read).
 * The action would get parameters for the option name, the value, and
 whether the value is based on the default (rather than being looked up
 from the database).
 * The action name would be aligned with the existing actions `add_option`,
 `update_option`, and `delete_option`.
 * It would be documented so that it should only be used for special cases
 (similar to e.g. the `all` filter).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56548>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list