Support

Account

Home Forums Backend Issues (wp-admin) How to get all ACF groups or field for specific post type Reply To: How to get all ACF groups or field for specific post type

  • This code is not working, I’ve tried it and it’s returning an empty array. I’ve trace the code and found out that the filter code always returns false when using outside of ACF.

    Function
    $groups = acf_get_field_groups(array('post_type' => 'your-post-type'));

    Filter code

    function acf_match_location_rule( $rule, $screen ) {
    	
    	// vars
    	$result = false;
    	
    	
    	// filter
    	$result = apply_filters( "acf/location/rule_match/{$rule['param']}", $result, $rule, $screen );
    	$result = apply_filters( "acf/location/rule_match", $result, $rule, $screen );
    	
    	
    	// return
    	return $result;
    	
    }

    Hope someone can help further explore find a solution for this 🙂