Title: Replace URL with Image
Last modified: August 20, 2016

---

# Replace URL with Image

 *  [c6ke](https://wordpress.org/support/users/c6ke/)
 * (@c6ke)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/)
 * Hey there!
    I’m trying to find a way to do the following: – User posts an URL
   to an Image on my hosted WP as a comment – WordPress shows The URL, not the image
   itself
 * Now, is there any way I can teach WordPress to replace that URL with the image
   itself (I don’t even need width and height as those are determined by CSS max-
   width and -height) and Yes: I can trust my users 😉
    It should work in Posts 
   and Comments, ideally.
 * So basically don’t show URLs but Images themselves. It works with Vimeo-URLs,
   Youtube-URLs and so on, but not with GIF, JPG…… if they come from URLS.
 * Thanks in advance for your help! I undestand average coding (CSS, Theme-Edit 
   and a slice of PHP) 😉

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [tomontoast](https://wordpress.org/support/users/tomontoast/)
 * (@tomontoast)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/#post-3276636)
 * You can do a regular expression replace on comment_content or post content using
   a filter.
 *  [tomontoast](https://wordpress.org/support/users/tomontoast/)
 * (@tomontoast)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/#post-3276637)
 * See [http://codex.wordpress.org/Function_Reference/add_filter](http://codex.wordpress.org/Function_Reference/add_filter)
   and [http://stackoverflow.com/questions/3371902/php-regex-get-image-from-url](http://stackoverflow.com/questions/3371902/php-regex-get-image-from-url)
 *  [tomontoast](https://wordpress.org/support/users/tomontoast/)
 * (@tomontoast)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/#post-3276638)
 * You could also try [http://wordpress.org/extend/plugins/wordpress-comment-images/](http://wordpress.org/extend/plugins/wordpress-comment-images/)
 *  Thread Starter [c6ke](https://wordpress.org/support/users/c6ke/)
 * (@c6ke)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/#post-3276639)
 * That is a great start. – THANKS!
    Wordpress already changes The URL-Texts to 
   clickable ones (inserting anchor-tags A). Do you possibly know where it does 
   that? In that case I’d only have to add that one IF-ELSE-Statement from stackoverflow
   😉
 *  [tomontoast](https://wordpress.org/support/users/tomontoast/)
 * (@tomontoast)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/#post-3276640)
 * I don’t actually know. This may help you [http://adambrown.info/p/wp_hooks/hook/pre_comment_content?version=3.4&file=wp-includes/comment.php](http://adambrown.info/p/wp_hooks/hook/pre_comment_content?version=3.4&file=wp-includes/comment.php)
 *  Thread Starter [c6ke](https://wordpress.org/support/users/c6ke/)
 * (@c6ke)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/#post-3276641)
 * That Plugin still works and just inserts BBCodes – which is fine with my users.
   Thank you very much!
    Perhaps I’ll care about the filter replacement soon but
   so far: This is great! Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Replace URL with Image’ is closed to new replies.

## Tags

 * [image](https://wordpress.org/support/topic-tag/image/)
 * [picture/](https://wordpress.org/support/topic-tag/picture/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 6 replies
 * 2 participants
 * Last reply from: [c6ke](https://wordpress.org/support/users/c6ke/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/replace-url-with-image/#post-3276641)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
