sanitize callback
-
Hello there!
I have created my own WordPress theme from scratch. And yesterday When i was uploading on WordPress. It says “REQUIRED: Found a Customizer setting that did not have a sanitization callback function. Every call to the add_setting() method needs to have a sanitization callback function passed.”
But I already have sanitize callback in each add_setting(). For example..
1. $wp_customize->add_setting(‘link_color’, array(
‘default’ => ‘#0078d7’,
‘transport’ => ‘refresh’,
‘sanitize_callback’ => ‘phoenix_sanitize_hex_color’,
));And it’s handler
function phoenix_sanitize_hex_color($color) {
if ($unhashed = sanitize_hex_color_no_hash($color))
return ‘#’ . $unhashed;
return $color;
}
2. similarly for checkbox
3. $wp_customize->add_setting( ‘phoenix_logo’, array(
‘default’ => ”,
‘capability’ => ‘edit_theme_options’,
‘sanitize_callback’ => ‘esc_url_raw’,
));
I have read a thread that says. If you define a default value as a variable and then you have to make a variable and then use it in add_settings. But I don’t think so!
Please help me!
- The topic ‘sanitize callback’ is closed to new replies.