Support

Account

Home Forums ACF PRO Adding locations to a field group Reply To: Adding locations to a field group

  • ok I begin to understand, thanks for your help and patience!
    I tried the following, but then I got no more ACF fields in the edit views nor in the acf admin view !

    
    add_filter('acf/get_field_group', 'my_modify_field_group_function');
    function my_modify_field_group_function($group) {
    
    	if ($field['key'] != 'group_58c6bfd3a0239') {
    	// not our field group
    	return;
    	}
    	
    	// add an OR rule to existing location rules for a specific field group
    	$group['location'][] = array(
    		array (
    			array (
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'post',
    			),
    		),
    		array (
    			array (
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'page',
    			),
    		),
    		array (
    			array (
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'portfolio',
    			),
    		),
    		array (
    			array (
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'team',
    			),
    		),
    	);
    	return $group;
    }