如何在Wordpress中以最安全的方式回应评论?

时间:2019-07-09 22:24:06

标签: php wordpress security

我试图编写一个完全基于用户评论的wordpress主题。我真的需要使我的评论文本区域真正安全。我将此功能编码为针对XSS攻击;

function antixss($comment) {


return sanitize_textarea_field(esc_html(esc_textarea($comment)));

}

add_filter('comment_text_rss', 'antixss');
add_filter('get_comment_text', 'antixss');
add_filter('get_comment_excerpt', 'antixss');

我使用comment_text()函数调用注释。

我不知道什么是最好的方法。

如果没有上述功能,则即使是alert(1);正在工作...

我如何使其更安全?

0 个答案:

没有答案