Make WordPress Core

Changeset 51340


Ignore:
Timestamp:
07/06/2021 12:43:21 PM (3 years ago)
Author:
desrosj
Message:

Docs: Correct @see references for hooks in the get_option() description.

Follow-up to [51050].

Props SergeyBiryukov.
Merges [51324] to the 5.8 branch.
See #52628, #53461.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/option.php

    r51050 r51340  
    1313 * boolean false is returned. This could be used to check whether you need
    1414 * to initialize an option during installation of a plugin, however that
    15  * can be done better by using {@see add_option} which will not overwrite
     15 * can be done better by using add_option() which will not overwrite
    1616 * existing options.
    1717 *
    18  * Not initializing an option and using the boolean false as a return value
     18 * Not initializing an option and using boolean `false` as a return value
    1919 * is a bad practice as it triggers an additional database query.
    2020 *
     
    2929 *
    3030 * Exceptions:
    31  * 1. When the option has not been saved in the database, the default value
    32  *    {@see get_option} is returned if provided. If not, boolean `false` is returned.
    33  * 2. When one of the Options API filters is used: {@see pre_option_{$option}},
    34  *    {@see default_option_{$option}}, and {@see option_{$option}}, the returned
     31 * 1. When the option has not been saved in the database, the `$default` value
     32 *    is returned if provided. If not, boolean `false` is returned.
     33 * 2. When one of the Options API filters is used: {@see 'pre_option_{$option}'},
     34 *    {@see 'default_option_{$option}'}, or {@see 'option_{$option}'}, the returned
    3535 *    value may not match the expected type.
    36  * 3. When the option has just been saved in the database, and {@see get_option}
     36 * 3. When the option has just been saved in the database, and get_option()
    3737 *    is used right after, non-string scalar and null values are not converted to
    3838 *    string equivalents and the original type is returned.
     
    4141 *
    4242 * When adding options like this: `add_option( 'my_option_name', 'value' );`
    43  * and then retrieving them with `get_option( 'my_option_name' )`, the returned
     43 * and then retrieving them with `get_option( 'my_option_name' );`, the returned
    4444 * values will be:
    4545 *
Note: See TracChangeset for help on using the changeset viewer.