[wp-trac] [WordPress Trac] #54459: Give get_option a third parameter to prevent DB queries

WordPress Trac noreply at wordpress.org
Wed Nov 17 14:44:05 UTC 2021


#54459: Give get_option a third parameter to prevent DB queries
-----------------------------------+------------------------------
 Reporter:  joostdevalk            |       Owner:  (none)
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Options, Meta APIs     |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------

Comment (by PieWP):

 @joostdevalk `get_option` contains a recursion on
 [https://github.com/jdevalk/wordpress-
 develop/blob/65e07520cfb7b68db3b7ac8e6472fe3d7c53ef92/src/wp-
 includes/option.php#L109| line 109] maybe you want to update your patch to
 also pass the parameter there.

 @desrosj yes there are multiple ways, but they require more effort than a
 `simple` third argument being passed. My current workaround consists of
 checking the wp cache, if its not cached it was not autoloaded.


 What I'm wondering though is how do we feel about consistency, if it is
 decided that @joostdevalk proposition is an elegant solution should that
 also be trickled down to other option methods? ( get_blog_option,
 get_site_option, get_network_option )

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


More information about the wp-trac mailing list