我希望能够"拒绝";在wp的后端不修改或删除注释内容的注释
在网站的前端,我希望将评论作者的名字正常列出,但不是评论的内容,而是一个简单的声明:"此评论因违反我们的tos而被拒绝";
我该怎么做呢?我没有找到一个插件来处理这个函数。
您可以使用下面的代码片段。这个代码片段将过滤要显示的注释文本。
function filter_text( $comment_text, $comment = null ) {
// Do something to the comment, possibly switching based on the presence of $comment
$comment_text = 'This comment was rejected for violations of our TOS';
return $comment_text;
}
add_filter( 'comment_text', 'filter_text', 10, 2 );