Changes between Initial Version and Version 1 of Ticket #55942, comment 63
- Timestamp:
- 05/02/2023 08:34:49 PM (17 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #55942, comment 63
initial v1 14 14 > - `add_option( 'my_option', false );` 15 15 16 This touches on "best practices" when using the options API: "All options should be set (and preferably autoloaded)". Currently when you do `add_option( 'my_option', false );` and then `get_option( 'my_option' );`, you get an empty string. That makes it possible to see if the option was set to `false`, but I don't think this is a "good behavior". Ideally whatever you save in the DB should come back the same. Returning strings for boolean and integer values is a long-standing inconsistency. Adding this param would make it easier to fix that .16 This touches on "best practices" when using the options API: "All options should be set (and preferably autoloaded)". Currently when you do `add_option( 'my_option', false );` and then `get_option( 'my_option' );`, you get an empty string. That makes it possible to see if the option was set to `false`, but I don't think this is a "good behavior". Ideally whatever you save in the DB should come back the same. Returning strings for boolean and integer values is a long-standing inconsistency. Adding this param would make it easier to fix that, and it also reduces calls to maybe_unserialize() a little.