Does not update `false` values
-
Hi!
We have noticed some strange behavior with Redis Object Cache. If the cache is enabled we can not update checkboxes to a
falsestate in ourwp_optionsdatabase table. You can run into the issue with the following example:add_action('customize_register', function ($wp_customize) { add_option('testc_checkbox_setting_id', true); $wp_customize->add_setting('testc_checkbox_setting_id', [ 'type' => 'option', 'sanitize_callback' => function ($checked) { return isset($checked) && true == $checked ? true : false; } ]); $wp_customize->add_control('testc_checkbox_setting_id', [ 'type' => 'checkbox', 'section' => 'static_front_page', 'label' => __('Custom Checkbox'), 'description' => __('This is a custom checkbox input.'), 'settings' => 'testc_checkbox_setting_id' ]); });This code simply registers a new checkbox in Design > Customizer > Homepage Settings > “CUSTOM CHECKBOX”. If you try now to deactivate the checkbox (state: not checked), the value never gets updated in the database.
If we deactivate the Redis object cache, all is working fine.
Status: Connected Client: PhpRedis (v5.2.2) Drop-in: Valid Disabled: No Filesystem: Working Ping: 1 Errors: [] PhpRedis: 5.2.2 Predis: Not loaded Credis: Not loaded PHP Version: 7.4.6 Plugin Version: 2.0.8 Redis Version: 6.0.3 Multisite: No Global Prefix: "wp_" Blog Prefix: "wp_" WP_REDIS_HOST: "redis" WP_REDIS_MAXTTL: "14400" WP_REDIS_PREFIX: "wp.io_obj:" WP_CACHE_KEY_SALT: "wp.io_obj:" Global Groups: [ "blog-details", "blog-id-cache", "blog-lookup", "global-posts", "networks", "rss", "sites", "site-details", "site-lookup", "site-options", "site-transient", "users", "useremail", "userlogins", "usermeta", "user_meta", "userslugs", "blog_meta" ] Ignored Groups: [ "counts", "plugins", "themes", "mailster", "WPML_ST_Package_Factory" ] Unflushable Groups: [] Drop-ins: [ "maintenance.php v by ", "Redis Object Cache Drop-In v2.0.8 by Till Krüss" ]Regards,
Matthew 🙂
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
The topic ‘Does not update `false` values’ is closed to new replies.