Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

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 – 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.