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.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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>';
Method 2
get_post_custom($post->ID) is what you need
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0