Title: Custom Field Value Only
Last modified: August 19, 2016

---

# Custom Field Value Only

 *  Resolved [ersnyder](https://wordpress.org/support/users/ersnyder/)
 * (@ersnyder)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/)
 * I am trying to do what I would think would be fairly easy to accomplish, but 
   apparently it is not (from what I have and have not found).
 * I would like to use a custom field in a PAGE (in my page.php) but only display
   the Value of that custom field rather than displaying the default – **Key:** 
   Value
 * Any ideas?

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

 *  [Justin Tadlock](https://wordpress.org/support/users/greenshady/)
 * (@greenshady)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739161)
 * I’m not exactly sure what you’re asking. To get a custom field value, you can
   do this:
 *     ```
       $key_name = get_post_custom_values($key = 'Key Name');
       echo $key_name[0];
       ```
   
 *  Thread Starter [ersnyder](https://wordpress.org/support/users/ersnyder/)
 * (@ersnyder)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739176)
 * That was it exactly, thank you!
 * Does that solution have any security issues as stated in this post?
 * [http://wordpress.org/support/topic/114618?replies=7](http://wordpress.org/support/topic/114618?replies=7)
 *  [Justin Tadlock](https://wordpress.org/support/users/greenshady/)
 * (@greenshady)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739189)
 * No, there aren’t any security issues with this.
 *  [ignitionmedia](https://wordpress.org/support/users/ignitionmedia/)
 * (@ignitionmedia)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739201)
 * Hi there,
    Just to extend on this as its somewhat what I am after…I dont quite
   understand how to use the custom feilds but am pretty sure its what I need to
   do what I want to do.
 * I have the one template but I want it to show different weather/images etc in
   the sidebar depending on the page (not post) that they are on.
 * Could I add the code for a weather plugin to the sidebar and add the above code
   where the weather ID goes (then add the weather ID as the value of the custom
   field for that page setting). eg
 * <?php if(function_exists(wp_forecast)) {
    wp_forecast( “<?php $key_name = get_post_custom_values(
   $key = ‘Key Name’); echo $key_name[0]; ?>” ); } ?>
 * Any help at all would be appreciated!!!
 * thanks
 *  [ignitionmedia](https://wordpress.org/support/users/ignitionmedia/)
 * (@ignitionmedia)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739218)
 * Just an update..
 * I am using
 * <?php if(function_exists(wp_forecast)) {
    wp_forecast( “<?php $key_name = get_post_custom_values(
   $key = ‘weather’); echo $key_name[0]; ?>” ); } ?>
 * and on my page I have added a Key called “weather” and given it the value of “
   A” which should return this code:
 * <?php if(function_exists(wp_forecast)) {
    wp_forecast( “A” ); } ?>
 * However this does not seem to work as the weather area returns “Sorry, no valid
   weather data available.” instead of showing the weather for A
 *  [Justin Tadlock](https://wordpress.org/support/users/greenshady/)
 * (@greenshady)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739253)
 * I could see you doing this on a single post or page in the sidebar but definitely
   not on other pages (home, archives, etc.) unless you knew the specific post ID
   you wanted to get custom field value for. There are probably better solutions
   if you only want to use this in the sidebar.
 *  [ignitionmedia](https://wordpress.org/support/users/ignitionmedia/)
 * (@ignitionmedia)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739296)
 * my home page isnt the blog, its a page set as the home page.. would that make
   a difference?

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

The topic ‘Custom Field Value Only’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [key](https://wordpress.org/support/topic-tag/key/)
 * [value](https://wordpress.org/support/topic-tag/value/)

 * 7 replies
 * 3 participants
 * Last reply from: [ignitionmedia](https://wordpress.org/support/users/ignitionmedia/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/custom-field-value-only/#post-739296)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
