[wp-trac] [WordPress Trac] #58962: Provide a way to load multiple specific options with a single database request
WordPress Trac
noreply at wordpress.org
Mon Oct 23 16:00:38 UTC 2023
#58962: Provide a way to load multiple specific options with a single database
request
-------------------------------------------------+-------------------------
Reporter: flixos90 | Owner: flixos90
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.4
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests has-dev- | Focuses:
note | performance
-------------------------------------------------+-------------------------
Comment (by hellofromTonya):
Replying to [comment:22 joemcgill]:
>To make the distinction and intent even more clear, I would consider
renaming these to
> * `wp_load_options()`
> * `wp_load_options_group()`
>While they still serve the purpose of loading and caching a set of
options, these names would avoid the confusion with internal `prime_`
functions and would more closely align with other option loading
functions, `wp_load_alloptions()` and `wp_load_core_site_options()`.
Yes, good idea Joe. The term "prime" is an internal term. And you're
right, these new functions do align well to `wp_load_alloptions()` and
`wp_load_core_site_options()`, which also load and prime caches.
>I think adding the `wp_` prefix is best practice for any new public
functions at this point, even if some of the most basic original functions
to get/update/delete objects omit the prefix. It also makes it very
obvious that these are meant to be used by extenders and not primarily as
core internals.
I agree. Also the prefixing with `wp_` avoids potential naming conflicts
in the wild.
**Overall**
* `wp_load_options()`
* `wp_load_options_by_group()`
I agree with adding the `wp_` prefix and the renaming to better align with
existing functions that load and prime caches. LGTM
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58962#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list