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.
2 Answers
you can use get_post_custom() which returns a multidimensional array with all custom fields of a particular post or page:
echo '<pre>';
print_r(get_post_custom($post_id));
echo '</pre>';
-
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– AnagioDec 22, 2012 at 9:24
-
@Anagio take a look at this codex.wordpress.org/Function_Reference/get_post_meta Dec 22, 2012 at 13:24