V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wwpp
V2EX  ›  WordPress

评论发图片后刷新不显示图片。

  •  
  •   wwpp · 2016-06-13 21:28:36 +08:00 · 2022 次点击
    这是一个创建于 2845 天前的主题,其中的信息可能已经有所发展或是发生改变。
    完成后贴入图片网址,提交可以显示,但是刷新就不能显示图片了~ 而且 HTM 图片代码变成
    <img data-original=" " alt="" />

    怎么破?求大大们帮帮看看啊


    根据以下代码

    function auto_comment_image( $comment ) {// by http://mufeng.me
    $post_ID = $comment["comment_post_ID"];
    if($post_ID == 972){ //此处为页面 id
    global $allowedtags;
    $content = $comment["comment_content"];
     
    // alt 部分自行填写
    $content = preg_replace('/( http:\/\/|https:\/\/){1}.+?\.(jpg|gif|bmp|bnp|png)$/is','<img src="http://mufeng.me/$0" alt="" />',$content);
     
    //允许发布 img 标签
    $allowedtags['img'] = array('src' => array (), 'alt' => array ());
     
    // 重新给$comment 赋值
    $comment["comment_content"] = $content;
    }
    return $comment;
    }
    add_filter('preprocess_comment', 'auto_comment_image');
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1149 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:58 · PVG 06:58 · LAX 15:58 · JFK 18:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.