kirki icon indicating copy to clipboard operation
kirki copied to clipboard

Theme Customizer Sanitization

Open blackmekemeke opened this issue 12 years ago • 8 comments

There is a problem with a required setting with the WordPress theme check plugin, this is the error that i get:

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.

blackmekemeke avatar Dec 04 '14 04:12 blackmekemeke

I second that.

venkatraj avatar Dec 17 '14 07:12 venkatraj

I found this, too.

problem

mennwebs avatar Jan 18 '15 09:01 mennwebs

@blackmekemeke @venkatraj @MennStudio I can't replicate this... Can you please post a code sample of what you're doing that gives you this error?

aristath avatar Jan 18 '15 19:01 aristath

Embed 'Kirki' to custom theme and check with 'Theme Check' plugin. That throws the error. New Theme Review Guidelines requires sanitization for each customizer settings.

The custom theme can be as simple as a child theme of Twenty Fifteen.

venkatraj avatar Jan 19 '15 01:01 venkatraj

I just pushed a new commit that should fix this for you... Can you please check that all your controls are still being saved? I added sanitization calls and wrote some custom functions where needed.

You can always however write your own sanitization function wherever you want to override the default ones simply by adding

'sanitize_callback' => 'my_custom_function'

to your field definitions.

aristath avatar Jan 19 '15 04:01 aristath

Thank you so much @aristath :)

mennwebs avatar Jan 20 '15 04:01 mennwebs

@aristath -

Would you mind adding this option to the documentation on kirki.org?

joshrcook avatar Mar 13 '15 13:03 joshrcook

Yup, I'm planning to.

I'm working on some major changes as we speak that will fix a lot of bugs. As soon as I push the new version up, I'll also update the docs. :)

aristath avatar Mar 13 '15 13:03 aristath