Support » Plugin: Theme Check » Why is it saying I don't have a sanitization callback when I do?

  • Resolved Donna Fontenot

    (@dazzlindonna)


    I’ve added 5 color pickers (footer background color, footer text color, that kind of thing), to Customizer, and have used the following sanitize code in each of the add_setting sections, and yet, Theme Check plugin still 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.

    Here’s an example of the code I use:

    // add footer text color picker setting
    $wp_customize->add_setting( 'footer_text_color', array(
    'default' => '‪#‎eeeeee‬',
    'sanitize_callback' => 'sanitize_hex_color'
    ) );

    Pulling my hair out here. I ONLY have 5 add_setting() methods in my functions and all 5 have the sanitize_callback line above. Any thoughts on why the Theme Check plugin would keep telling me I’m missing one?

    https://wordpress.org/plugins/theme-check/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    There’s nothing wrong with that line, it passes the theme-check. Just tested it.

    It must be giving you the error on something else.

    Thread Starter Donna Fontenot

    (@dazzlindonna)

    I found it. All 5 of those santizie_callback lines looked exactly the same – to the naked eye. But when I did a CTRL-F to find that line, it showed only 4 of the 5. Despite the 5th looking exactly the same, there was something different about it – hidden character, or something like that. When I redid that line, the error disappeared. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Why is it saying I don't have a sanitization callback when I do?’ is closed to new replies.