Make WordPress Core

Changeset 56990


Ignore:
Timestamp:
10/23/2023 09:27:31 PM (13 months ago)
Author:
flixos90
Message:

Options, Meta APIs: Rename prime_options() to wp_load_options().

This clearly separates these functions which are intended to be used by external developers from the existing _prime_*_caches() functions which are primarily intended for internal usage. The term "load" is additionally more accessible than "prime".

This changeset renames the above function, as well as the wrapper function prime_options_by_group() to wp_load_options_by_group().

Props peterwilsoncc, joemcgill, hellofromTonya, poran766, flixos90.
Fixes #58962.

Location:
trunk
Files:
2 added
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/option.php

    r56946 r56990  
    249249
    250250/**
    251  * Primes specific options into the cache with a single database query.
    252  *
    253  * Only options that do not already exist in cache will be primed.
     251 * Loads specific options into the cache with a single database query.
     252 *
     253 * Only options that do not already exist in cache will be loaded.
    254254 *
    255255 * @since 6.4.0
     
    257257 * @global wpdb $wpdb WordPress database abstraction object.
    258258 *
    259  * @param array $options An array of option names to be primed.
    260  */
    261 function prime_options( $options ) {
     259 * @param array $options An array of option names to be loaded.
     260 */
     261function wp_load_options( $options ) {
    262262    $alloptions     = wp_load_alloptions();
    263263    $cached_options = wp_cache_get_multiple( $options, 'options' );
     
    271271    }
    272272
    273     // Bail early if there are no options to be primed.
     273    // Bail early if there are no options to be loaded.
    274274    if ( empty( $options_to_prime ) ) {
    275275        return;
     
    322322
    323323/**
    324  * Primes all options registered with a specific option group.
     324 * Loads all options registered with a specific option group.
    325325 *
    326326 * @since 6.4.0
     
    328328 * @global array $new_allowed_options
    329329 *
    330  * @param string $option_group The option group to prime options for.
    331  */
    332 function prime_options_by_group( $option_group ) {
     330 * @param string $option_group The option group to load options for.
     331 */
     332function wp_load_options_by_group( $option_group ) {
    333333    global $new_allowed_options;
    334334
    335335    if ( isset( $new_allowed_options[ $option_group ] ) ) {
    336         prime_options( $new_allowed_options[ $option_group ] );
     336        wp_load_options( $new_allowed_options[ $option_group ] );
    337337    }
    338338}
     
    341341 * Retrieves multiple options.
    342342 *
    343  * Options are primed as necessary first in order to use a single database query at most.
     343 * Options are loaded as necessary first in order to use a single database query at most.
    344344 *
    345345 * @since 6.4.0
     
    349349 */
    350350function get_options( $options ) {
    351     prime_options( $options );
     351    wp_load_options( $options );
    352352
    353353    $result = array();
Note: See TracChangeset for help on using the changeset viewer.