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\]/'),'', $comment);
return $comment;
}
在评论区添加的代码如下:
[img]在这里填写图片链接[/img]
THE END
二维码
文章目录
关闭
共有 0 条评论