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]

 

版权声明:
作者:小马
链接:https://www.xiaomaw.cn/580.html
来源:小马博客
文章版权归作者所有,未经允许请勿转载。
THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录