Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Echo values for custom fields with the same ‘key’ value Re: Echo values for custom fields with the same ‘key’ value

#67071
gno
Member

Im back again after a good nights sleep. I’m sorry, but I was too lazy to look this up last night.

A quick view in the wordpress documentation revealed that my suspicion was right.

You should not use get_post_meta(), but get_post_custom_values(). It does the same thing, but is for when you have customfields with non unique keys. It returns an array that you can throw in a foreach.

Link to the manual page: http://codex.wordpress.org/Function_Reference/get_post_custom_values

Example, build on the code from the OP:



EDIT: (I have no idea why it screwed the coloring and indexing of the code above…)