Title: humjay's Replies | WordPress.org

---

# humjay

  [  ](https://wordpress.org/support/users/humjay/)

 *   [Profile](https://wordpress.org/support/users/humjay/)
 *   [Topics Started](https://wordpress.org/support/users/humjay/topics/)
 *   [Replies Created](https://wordpress.org/support/users/humjay/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/humjay/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/humjay/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/humjay/engagements/)
 *   [Favorites](https://wordpress.org/support/users/humjay/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [[Plugin: Custom Field Template] can you config the template to just insert the IMAGE URL ?](https://wordpress.org/support/topic/plugin-custom-field-template-can-you-config-the-template-to-just-insert-the-image-url/)
 *  [humjay](https://wordpress.org/support/users/humjay/)
 * (@humjay)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-can-you-config-the-template-to-just-insert-the-image-url/#post-1162176)
 * I solved this by using some regex in my template to detect if the output was 
   a full image tag or just a url like so:
 *     ```
       if( get_post_meta($post->ID, 'images')):
       $images = get_post_meta($post->ID, 'images'); 
   
       foreach($images as $image):
       if(strpos($image, "<img") !== FALSE):
         preg_match('/src=[\"\']([^\"\']+)/i', $image, $matches);
         $imageurl = $matches[1];
       else:
         $imageurl = $image;
       endif;
       ```
   
 * You can then use the imageurl variable wherever you need the source. This code
   will let someone just paste in the url or use the media library to insert a full
   image.

Viewing 1 replies (of 1 total)