[wp-trac] [WordPress Trac] #37178: Add $cache_only parameter to get_option

WordPress Trac noreply at wordpress.org
Sun Jun 26 11:21:10 UTC 2016


#37178: Add $cache_only parameter to get_option
-------------------------+------------------------------------
 Reporter:  joostdevalk  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:  has-patch dev-feedback
  Focuses:  performance  |
-------------------------+------------------------------------
 When you do `get_option()` and the option doesn't exist in the option
 cache, WordPress does a query to check whether that option exists and
 loads it. This is great as default behavior, but when you ''know'' that an
 option would have been autoloaded, you might not want that to happen.

 I propose adding a parameter `$cache_only`, which defaults to false,
 which, when set to true, returns false when there is no option set in the
 cache. The "workaround" currently would be to set an empty option, but
 that means adding unnecessary data to the database.

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


More information about the wp-trac mailing list