Home › Forums › ACF PRO › List all ACF fields › Reply To: List all ACF fields
Hi @sixtyseven
There isn’t a way I know of to display all fields other than running a query on the wp_postmeta table yourself and discerning what’s an ACF field and what isn’t by testing or joining to the wp_posts table.
But, if you have a particular ID of a page or post or options page that you want to get the custom fields for, you can use get_field_objects($postID);
to get an array of fields along with various details about each field.
You can then loop through them and use get_field('field_name', $postID);
to get the value of a particular field if you need to show values too.
I recently needed to do something similar to generate a ‘report’ which listed all custom fields and exported to a .csv – to do this, I first created a draft post with all custom fields filled in, saved it & used get_field_objects()
for this post. I then took the resulting array & looped through it for each of the other posts to get the data. Perhaps not the most efficient way but it works.
Hope this helps
cheers
alan
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.