有没有办法允许我的用户将HTML5视频标签(不带短代码)添加到我的文本字段/文本区域?允许的锚样式和粗体标记正在工作,但一旦我添加“视频”和“源”,它就不再工作了:(
感谢您的帮助。谢谢。
function validate_setting($plugin_options){
//This Works
$allowed_html = array(
\'a\' => array(
\'href\' => array (),
\'title\' => array ()),
//This works also
\'b\' => array(
\'style\'=> array(),
),
//This is not working...
\'video\' = array(
\'width\' => true,
\'height\' => true
),
//This also is not working...
\'source\' = array(
\'src\' => true,
\'type\' => true
),
);
$plugin_options[\'text_area\']= wp_kses($plugin_options[\'text_area\'],$allowed_html);
return $plugin_options;
}
最合适的回答,由SO网友:Dejo Dekic 整理而成
好啊This Thread 确实帮了我很多!
所以现在我的功能正常了(我可以盗用HTML5视频),它看起来是这样的:
function validate_setting($plugin_options){
global $allowedtags;
$allowedtags = array(
\'a\' => array(
\'href\' => array (),
\'title\' => array ()),
\'b\' => array(
\'style\'=> array(),
),
);
$allowedtags[\'video\'] = array(
\'width\' => true,
\'height\' => true
);
$allowedtags[\'source\'] = array(
\'src\' => true,
\'type\' => true
);
$plugin_options[\'text_area\'] = wp_kses($plugin_options[\'text_area\'],$allowedtags);
return $plugin_options;
}