admin管理员组文章数量:1279055
I'm a bit confused. Why is the wp_kses_allowed_html
hook not triggered on the frontend of my WordPress website, but it is on the wp-admin backend?
I have added the code below to the very top of my plugin file. I want it to allow a custom data attribute on an <a>
element.
add_filter('wp_kses_allowed_html', function($allowed_tags, $context) {
error_log("wp_kses_allowed_html triggered");
if (!isset($allowed_tags['a'])) {
$allowed_tags['a'] = array();
}
$allowed_tags['a']['data-custom-attribute'] = true;
return $allowed_tags;
}, 10, 2);
本文标签: phpwpksesallowedhtml not triggered on WP frontendStack Overflow
版权声明:本文标题:php - wp_kses_allowed_html not triggered on WP frontend - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741253008a2366145.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论