收集一波常见的加速NPM包的CDN,发现有些还是挺好用的,基本上可以替代unpkg、jsdelivr,用来做博客或者网站加载NPM使用还是可以的。......
WordPress评论中禁止HTML代码显示的方法
本文实例讲述了WORDPRESS评论中禁止HTML代码显示的方法。分享给大家供大家参考。具体分析如下:
使用WORDPRESS的朋友会发现如果我们开户了博客评论会经常看到大量的垃圾广告,带连接了,那么我们要如何禁止用户输入html标签原样输出,而不显示呢,下面我来给大家介绍.
html标题无非就是由“”、“>”组成了,我们可以反它转换成“<”、“>”,这样通过HTML编译,自动变成了“”、“>” 我们也可以直接替换掉了
找到一国外人的代码,搞定了,不过不一定他是原作者,在functions.php的PHP代码里加入如下代码:复制代码代码如下://禁用WORDPRESS评论html代码 // 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; } add_filter( 'preprocess_comment', 'plc_comment_post', '', 1); add_filter( 'comment_text', 'plc_comment_display', '', 1); add_filter( 'comment_text_rss', 'plc_comment_display', '', 1); add_filter( 'comment_excerpt', 'plc_comment_display', '', 1);
希望本文所述对大家的WORDPRESS建站有所帮助。
以上方法由办公区教程网编辑摘抄整理自互联网可供大家参考!
相关文章
- 详细阅读
-
WordPress网站文章ID不连续如何解决?笔记已测试详细阅读
对于WordPress网站文章ID不连续的问题困扰了我很久,今天将WordPress文章ID不连续的原因和具体解决办法做详细的说明。 WordPress文章ID不连续的原因: 用WordPress做网站的站......
2023-08-17 24
-
wordpress建站教程:文章自动调用特色图片详细阅读
继续分享wordpress建站教程。我们在日常更新wordpress网站文章时基本都需要手动添加文章的缩略图,一般是根据文章内容来添加,虽然麻烦一点,但效果更好,对普通的企业wordpress外......
2023-08-14 66