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