Sanitize Callback fallback
-
I am using the WP customizer to allow users to customise the html class of a certain element. As required, I have added the sanitize callback to sanitize user input. I would like the user to be able to set it to either a valid html class or an empty string. However, if an empty string is entered, wordpress will fail to save the customization. How can I set the $fallback value in such a case?
$wp_customize->add_setting( ‘voce_social_icon_1’ , array(‘default’ => ‘fa-facebook’, ‘sanitize_callback’ => ‘sanitize_html_class’,));
I am only having such problems with ‘sanitize_html_class’, ‘esc_url_raw’ happily accepts an empty string.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Sanitize Callback fallback’ is closed to new replies.