Embed Comment Images in WordPress

November 17, 2013Hellas34 Comments

Wordpress allow use of html img tag  in the comments, so the images are shown directly if wrapped with it, but most of the people who visits our blogs do not know how to use html tags. After unsuccessful searching for instant solution, I decided to build a plugin which exactly do that.

This plugin is simple. It uses preg_replace to detect direct image links in comments and wraps those with the img html tag. On top of it, you can specify width of your comment so it creates container and then fits image into it. It does not resize image it just puts image of any size into specified container. This is good because nothing is stored on your server, but bad because people can link images of virtually any size which will slow loading of your page for your visitors.


I am planning in next version to detect size of the image on given link and if it is over X megabytes and x*y pixels it skips wrapping image in IMG tag.

Currently this plugin embeds only images with .jpg, .png and .gif extension, but I am planing making interface so you can specify which image types should be embedable.

You can download plugin from WordPress.org or here:


Embed Comment Images DEMO

You can use this post as a testing demo. Just copy/paste the image link directly into the comment field.


If you want to embed video content URLs in the comments, you can do so by using oEmbed plugin.

This article has 34 comments
  1. Hellas
    November 17, 2013

  2. Avet
    November 17, 2013

    i malo teksta

  3. Barum
    September 18, 2014


  4. Frank
    February 24, 2015

    Hello, I installed this and imgur links dont work.

    for example…

    just shows..

    “>” alt=”” width=”500″ height=”304″ />

  5. 8eristis
    March 16, 2015

  6. Hellas
    March 16, 2015

  7. Hellas
    March 16, 2015

    It works with imgur links. Above image is from imgur and it shows just fine.

  8. dan
    April 28, 2015

  9. Rose
    November 13, 2015


  10. Red Racer Jimmy
    March 11, 2016

  11. winda
    May 23, 2016

  12. amberlee_d@icloud.com
    June 6, 2016

  13. Dennis
    June 22, 2016

  14. robert
    September 8, 2016

  15. mscynlynn
    September 25, 2016


  16. rrrrrrrrrrrr
    September 29, 2016


  17. Hellas
    November 10, 2016

  18. ADN
    November 10, 2016

  19. wooot
    December 16, 2016

  20. Nelson
    January 15, 2017

  21. Turtles Run
    February 7, 2017

  22. zzz
    April 12, 2017

  23. Joy
    May 3, 2017

    Hello, your update is great, but the images don’t show up in comment widgets or site wide activity (buddypress). Any plans for an update or any ideas on how I could implement that functionality? Thank you!

  24. erwerfwe
    May 16, 2017

  25. erwerfwe
    May 28, 2017

  26. john
    June 16, 2017

  27. alfono
    June 21, 2017

  28. juana
    August 31, 2017

  29. Rashad
    September 18, 2017

  30. Mark
    September 30, 2017


  31. test
    October 5, 2017

  32. jonco
    October 20, 2017

  33. lala
    January 29, 2018


Leave a Reply