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

WordPress Trac noreply at wordpress.org
Mon Jan 30 00:56:53 UTC 2023


#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:  2.2
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+---------------------

Comment (by peterwilsoncc):

 I wrote up a mini plugin to
 [https://gist.github.com/peterwilsoncc/580c8bea21f1cddfbd8ff151d8718024
 test the advantages of this change].

 || **Filter**         || **Time**                  ||
 || option_siteurl     || 4.357578754425 * 10^-5^ seconds ||
 || pre_option_siteurl || 1.505925655365 * 10^-5^ seconds ||

 As a multiple it seems impressive, but for a single run it's 28
 microseconds. This is using vagrant on virtual box which is typically a
 slow system.

 Granted, the option is retrieved numerous times during the typical
 request, but even at a generous 100 runs, the time saved is around 3
 milliseconds.

 If the change requires adding snowflake code to `get_option` or
 `remove_filter` as a special case, I don't see the value in doing so. With
 low usage of the constants, there's greater value to be gained improving
 performance elsewhere.

 As the most popular plugins linked to above are using the later filters to
 ensure the sites are running over https, rather than http, I think there's
 some risk in simply moving the hook to run earlier.

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


More information about the wp-trac mailing list