WordPress 评论区添加图片代码并自动显示
在functions.php里添加
//评论加图片 add_action('comment_text', 'comments_embed_img', 2); function comments_embed_img($comment) { $size = auto; $comment = preg_replace(array('/\[img\]((http|https):\/\/\S*)\[\/img\]/'),'<img src="$1" alt="评论" style="width:'.$size.'; height:'.$size.'" />', $comment); return $comment; }
在评论区添加的代码如下:
[img]在这里填写图片链接[/img]
1。隐藏的权限内容含有文章资源下载地址等信息。
2。链接失效或文章信息有误,请留言。
2。链接失效或文章信息有误,请留言。