[wp-trac] [WordPress Trac] #56849: Modify `_config_wp_home()` and `_config_wp_siteurl()` to become pre_option filters

WordPress Trac noreply at wordpress.org
Tue Oct 18 21:52:32 UTC 2022


#56849: Modify `_config_wp_home()` and `_config_wp_siteurl()` to become pre_option
filters
--------------------------------+-------------------------
 Reporter:  flixos90            |      Owner:  (none)
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  6.2
Component:  Options, Meta APIs  |    Version:
 Severity:  normal              |   Keywords:  2nd-opinion
  Focuses:                      |
--------------------------------+-------------------------
 The functions  `_config_wp_home()` and `_config_wp_siteurl()` are
 currently used to enforce values for the "home" and "siteurl" options, if
 the respective `WP_HOME` / `WP_SITEURL` constant is set.

 However, the way this currently happens is by hooking into the
 `option_home` and `option_siteurl` filters. This is a bit wasteful since
 it means all the logic to still look up the option is still run
 unnecessarily.

 We should change the approach so that the two callbacks become filter
 callbacks for `pre_option_home` and `pre_option_siteurl` instead. This
 way, if the constants are defined, the logic in `get_option()` can bail
 early.

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


More information about the wp-trac mailing list