I've developed a Wordpress template, and I'm looking forward to uploading to the wordpress.org repository, but both its check system and plugin Theme Check give the following message:
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.
I have tried several possibilities to work around this problem, including trying to use native Wordpress filters, and nothing works.
include / customizer.php (with the same method used by several official templates already approved)
/*
* Footer text
*/
$wp_customize->add_setting(
'jamanto_customizer_footer_text',
array(
'default' => '© 2052',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'jamanto_sanitize_text',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'jamanto_customizer_footer_text',
array(
'label' => __( 'Footer text', 'jamanto' ),
'section' => 'jm_section_settings',
'settings' => 'jamanto_customizer_footer_text',
'type' => 'text',
)
)
);
/*
* Sanitize
*/
function jamanto_sanitize_text( $string ) {
return trim( $string );
}
And the template link in github: link
However, even though displaying this message, in Custom all filters work normally. Also, I noticed that it's not just me, there are several people in the Wordpress forum with the same problem, what can I do?