WordPress 去除评论使用HTML代码的提示

  1. 首页
  2. 笔记
  3. WordPress 去除评论使用HTML代码的提示
592 次阅读
笔记

简单方法在WordPress中去除“评论使用Html代码”的提示

步骤1:找到主题中的comments.php文件,

// 查找
<?php comment_form(); ?>,
// 替换为
<?php comment_form(array('comment_notes_after' => '')); ?>

步骤2:找到主题的functions.php文件,在文件末尾 ?>处之前,增加以下代码:

// This will occur when the comment is posted
function plc_comment_post( $incoming_comment ) {
// convert everything in a comment to display literally
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );
return( $incoming_comment );
}
// This will occur before a comment is displayed
function plc_comment_display( $comment_to_display ) {
// Put the single quotes back in
$comment_to_display = str_replace( ''', "'", $comment_to_display );
return $comment_to_display;
上一篇文章
Windows 和 Office的序列号和激活方法
下一篇文章
使用PowerShell强行卸载Windows 10自带的App

相关阅读

要发表评论,您必须先登录

最新文章

菜单