Changeset 51340
- Timestamp:
- 07/06/2021 12:43:21 PM (3 years ago)
- Location:
- branches/5.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.8
-
branches/5.8/src/wp-includes/option.php
r51050 r51340 13 13 * boolean false is returned. This could be used to check whether you need 14 14 * to initialize an option during installation of a plugin, however that 15 * can be done better by using {@see add_option}which will not overwrite15 * can be done better by using add_option() which will not overwrite 16 16 * existing options. 17 17 * 18 * Not initializing an option and using the boolean falseas a return value18 * Not initializing an option and using boolean `false` as a return value 19 19 * is a bad practice as it triggers an additional database query. 20 20 * … … 29 29 * 30 30 * Exceptions: 31 * 1. When the option has not been saved in the database, the defaultvalue32 * {@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 returned31 * 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 35 35 * 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() 37 37 * is used right after, non-string scalar and null values are not converted to 38 38 * string equivalents and the original type is returned. … … 41 41 * 42 42 * When adding options like this: `add_option( 'my_option_name', 'value' );` 43 * and then retrieving them with `get_option( 'my_option_name' ) `, the returned43 * and then retrieving them with `get_option( 'my_option_name' );`, the returned 44 44 * values will be: 45 45 *
Note: See TracChangeset
for help on using the changeset viewer.