Title: question about get_post_meta()
Last modified: August 21, 2016

---

# question about get_post_meta()

 *  [cfetr](https://wordpress.org/support/users/cfetr/)
 * (@cfetr)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/question-about-get_post_meta/)
 * Greetings everyone,
 * I am a new developer to WordPress. I have been browsing tutorials and the forums
   about adding metaboxes to posts. I can do all that successfully so thanks to 
   everyone who asks questions and replies with answers.
 * To my question, in tutorials I see everyone using this:
    `$meta = get_post_meta(
   $post->ID)` and then accessing their fields like so: `$meta['my_custom_field']`
 * This does not work for me. $meta[‘my_custom_field’] will always be an array and
   I will need to use $meta[‘my_custom_field’][0]. Can anyone explain to me why 
   this is happening? Are the tutorials just out of date?
 * Thanks for your help

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

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/question-about-get_post_meta/#post-3880015)
 * The tutorials are either out of date or wrong. That’s how `get_post_meta()` has
   behaved ever since I’ve had to use it.
 * If you’re working with single values, it’s normally eaiser to use `get_post_meta(
   $post->ID, "meta_key", true)` to get the single value that’s set for that key.
 *  Thread Starter [cfetr](https://wordpress.org/support/users/cfetr/)
 * (@cfetr)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/question-about-get_post_meta/#post-3880161)
 * Thanks, that is what I figured.
 *  [Timothy Jacobs](https://wordpress.org/support/users/timothyblynjacobs/)
 * (@timothyblynjacobs)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/question-about-get_post_meta/#post-3880208)
 * Not exactly true, you can still get the results as an array, like above, but 
   it is important to note that by default the results are wrapped inside an array.
   just change your call to `get_post_meta($post->ID, , true);` which will return
   it without being wrapped in an array. Take a look at the [codex](http://codex.wordpress.org/Function_Reference/get_post_meta)
   page.

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

The topic ‘question about get_post_meta()’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 3 participants
 * Last reply from: [Timothy Jacobs](https://wordpress.org/support/users/timothyblynjacobs/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/question-about-get_post_meta/#post-3880208)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
