Quantcast
Viewing all articles
Browse latest Browse all 8245

cfetr on "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 all articles
Browse latest Browse all 8245

Trending Articles