WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the best way to display/dump all custom fields associated with a post? It doesn't have to be pretty, I just need to verify what is being saved in what field array for debugging.

share|improve this question
up vote 5 down vote accepted

you can use get_post_custom() which returns a multidimensional array with all custom fields of a particular post or page:

echo '<pre>';
echo '</pre>';
share|improve this answer
That worked great, thank you! – mattrepublic May 26 '11 at 14:08
I'm using this function to print the array, how can I specify only two custom fields to print their key and value? custom1, and custom2 – Anagio Dec 22 '12 at 9:24
@Anagio take a look at this codex.wordpress.org/Function_Reference/get_post_meta – Bainternet Dec 22 '12 at 13:24

get_post_custom($post->ID) is what you need

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.