我给customizer.php添加了一个新设置
$wp_customize->add_setting( 'understrap_footer_text', array(
'default' => 'Copyright © 2017' ,
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_textarea_field',
'capability' => 'edit_theme_options',
) );
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'understrap_footer_text', array(
'label' => __( 'Footer Text', 'understrap' ),
'description' => __( "No HTML", 'understrap'),
'section' => 'understrap_theme_post_options',
'settings' => 'understrap_footer_text',
'type' => 'textarea',
'priority' => '10',
)
) );主题检查插件错误: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.
当我从默认的© ()文本中删除add_setting()时,它没有显示错误。
十进制代码©也不能工作。
我需要显示©符号,有什么方法可以让这个工作吗?
发布于 2018-03-28 09:26:08
您需要确保您有回调函数来处理您的卫生处理。
$wp_customize->add_setting( 'understrap_footer_text', array(
'default' => 'Copyright © 2017' ,
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_textarea_field',
'capability' => 'edit_theme_options',
) );所以你需要像这样的函数
/**
* [sanitize_html description]
* @param [string] $input [input from textarea]
* @return [string] [sanitize all input no tags]
*/
function sanitize_textarea_field( $input ) {
return wp_strip_all_tags( $input );
}https://wordpress.stackexchange.com/questions/299137
复制相似问题