Changeset 53317 for trunk/src/wp-includes/option.php
- Timestamp:
- 04/29/2022 07:22:56 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/option.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/option.php
r52707 r53317 29 29 * 30 30 * Exceptions: 31 * 31 32 * 1. When the option has not been saved in the database, the `$default` value 32 33 * 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 returned34 * 2. When one of the Options API filters is used: {@see 'pre_option_$option'}, 35 * {@see 'default_option_$option'}, or {@see 'option_$option'}, the returned 35 36 * value may not match the expected type. 36 37 * 3. When the option has just been saved in the database, and get_option() … … 40 41 * Examples: 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 * When adding options like this: `add_option( 'my_option_name', 'value' )` 44 * and then retrieving them with `get_option( 'my_option_name' )`, the returned 44 45 * values will be: 45 46 * 46 * `false` returns `string(0) ""`47 * `true` returns `string(1) "1"`48 * `0` returns `string(1) "0"`49 * `1` returns `string(1) "1"`50 * `'0'` returns `string(1) "0"`51 * `'1'` returns `string(1) "1"`52 * `null` returns `string(0) ""`47 * - `false` returns `string(0) ""` 48 * - `true` returns `string(1) "1"` 49 * - `0` returns `string(1) "0"` 50 * - `1` returns `string(1) "1"` 51 * - `'0'` returns `string(1) "0"` 52 * - `'1'` returns `string(1) "1"` 53 * - `null` returns `string(0) ""` 53 54 * 54 55 * When adding options with non-scalar values like 55 * `add_option( 'my_array', array( false, 'str', null ) ) ;`, the returned value56 * `add_option( 'my_array', array( false, 'str', null ) )`, the returned value 56 57 * will be identical to the original as it is serialized before saving 57 58 * it in the database: 58 59 * 59 * array(3) {60 * [0] => bool(false)61 * [1] => string(3) "str"62 * [2] => NULL63 * }60 * array(3) { 61 * [0] => bool(false) 62 * [1] => string(3) "str" 63 * [2] => NULL 64 * } 64 65 * 65 66 * @since 1.5.0
Note: See TracChangeset
for help on using the changeset viewer.