Accessing ACF Core Post Types

ACF (Advanced Custom Fields) registers just 2 custom post types. Amazing isn’t it, that one of the most sophisticated and useful WordPress plugins that powers millions of dynamic websites, utilizes just 2 CPT’s to get the job done. Those post types have the keys “acf-field-group” and “acf-field”.

Individual fields that you create in ACF are “acf-field” posts, and the field group they are grouped into are “acf-field-group” posts. Nice and simple!

You can, if you need too, utilize WordPress core functions like get_posts() or a WP_Query to fetch and view the registered field groups and individual fields on any WordPress site.

ACF provides a utility function that will load all field groups:

$field_groups = acf_get_field_groups();

The following code snippet will loop over each field group and var_dump each field:

$fgs = acf_get_field_groups();
		if( ! empty( $fgs ) ) {
			foreach( $fgs as $fg ) {
				$fields = acf_get_fields( $fg['key'] );
				var_dump( $fields );
			}
		}