Title: Custom Fields Image Problem
Last modified: August 20, 2016

---

# Custom Fields Image Problem

 *  [TheIslander](https://wordpress.org/support/users/theislander/)
 * (@theislander)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/custom-fields-image-problem/)
 * I’ve got a number of image URLs in custom fields on pages – I want to be able
   to display them in image tags.
 * I’m using this:
 *     ```
       <img alt="sunset" src="<?php echo get_post_meta($post_id->ID, 'bottom', true) ?>" height="150" width="450" border="0" />
       ```
   
 * The result is an empty SRC tag:
 *     ```
       <img alt="sunset" src="" height="150" width="450" border="0">
       ```
   
 * The custom field IS in fact returning the URL, but for some reason; it is not
   displaying. I used exit/var_dump to verify this.
 * My functions file is empty, do I need any function code to allow custom fields?
   or to change any wordpress settings?
    How can I fix this?
 * thanks,

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/custom-fields-image-problem/#post-2414806)
 * try:
 * `<img alt="sunset" src="<?php echo get_post_meta($post->ID, 'bottom', true) ?
   >" height="150" width="450" border="0" />`
 *  Thread Starter [TheIslander](https://wordpress.org/support/users/theislander/)
 * (@theislander)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/custom-fields-image-problem/#post-2414862)
 * Hi alchmyth,
    The code you posted is in fact what I have written in the file,
   yet there are no results.
 * any ideas?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/custom-fields-image-problem/#post-2414864)
 * the code that I posted is different from the code you posted – that is the only
   thing I can see;
    right `$post->ID` vs. wrong `$post_id->ID`
 * please paste the **full **code of the template into a [http://pastebin.com/](http://pastebin.com/)
   and post the link to it here.
 *  Thread Starter [TheIslander](https://wordpress.org/support/users/theislander/)
 * (@theislander)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/custom-fields-image-problem/#post-2414866)
 * [edit: I’ve solved it] thanks!
 * For Future reference, the problem was as alch rightfully pointed out. $post instead
   of $post_id; also, one should use ” instead of “”.
 * thanks again!

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

The topic ‘Custom Fields Image Problem’ is closed to new replies.

## Tags

 * [html](https://wordpress.org/support/topic-tag/html/)
 * [img](https://wordpress.org/support/topic-tag/img/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 4 replies
 * 2 participants
 * Last reply from: [TheIslander](https://wordpress.org/support/users/theislander/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/custom-fields-image-problem/#post-2414866)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
