Support

Account

Home Forums General Issues Stray Field (blank field no label) Reply To: Stray Field (blank field no label)

  • Thanks for the info and all your attention. I started debugging. I went to /wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php and into the flex_content block (around line 350) and entered:

    // loop over sub fields
    foreach( array_keys($sub_fields) as $j ) {
    	
    	// extract sub field
    	$sub_field = acf_extract_var( $sub_fields, $j );
    	echo '============ start ============= <br />';
    	var_dump('SUB_FIELD KEY: ' . $sub_field['key']);
    	echo '<br />';
    	var_dump('SUB_FIELD LABEL: ' . $sub_field['label']);
    	echo '<br />';
    	var_dump('SUB_FIELD TYPE: ' . $sub_field['type']);
    	echo '<br />';
    	var_dump('FIELD_KEY: ' . $field['key']);
    	echo '<br />';
    	
    	// attributes
    	$sub_field['parent'] = $field['key'];
    	var_dump('SUBFIELD_PARENT: ' . $sub_field['parent']);
    	echo '<br />';
    	$sub_field['parent_layout'] = $layout['key'];
    	if(empty($sub_field['parent']))
    	{
    		echo '== PARENT EMPTY - Printing $sub_fields ==<br />';
    		echo '<pre>'; print_r($sub_fields);
    	}
    	echo '<br />============ end ============= <br />';
    	echo '<br />';
    	
    	// append to extra
    	$extra[] = $sub_field;
    	
    }

    The output I got was pretty strange. I have a lot of fields in that flex content – all were outputting correctly and then there were two “mystery arrays” at the end that were empty or mostly empty (one just had a “max” key).

    ...
    
    ============ start =============
    string(34) "SUB_FIELD KEY: field_5880edb261233"
    string(24) "SUB_FIELD LABEL: Heights"
    string(21) "SUB_FIELD TYPE: radio"
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(36) "SUBFIELD_PARENT: field_5508921ee1487"
    
    ============ end =============
    
    ============ start =============
    string(34) "SUB_FIELD KEY: field_5880eef761234"
    string(29) "SUB_FIELD LABEL: Fixed Height"
    string(22) "SUB_FIELD TYPE: number"
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(36) "SUBFIELD_PARENT: field_5508921ee1487"
    
    ============ end =============
    
    ============ start =============
    string(15) "SUB_FIELD KEY: "
    string(17) "SUB_FIELD LABEL: "
    string(16) "SUB_FIELD TYPE: "
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(18) "SUBFIELD_PARENT: f"
    == PARENT EMPTY - Printing $sub_fields ==
    
    Array
    (
        [max] => 
    )
    
    ============ end ============= 
    
    ============ start ============= 
    string(15) "SUB_FIELD KEY: "
    string(17) "SUB_FIELD LABEL: "
    string(16) "SUB_FIELD TYPE: "
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(18) "SUBFIELD_PARENT: f"
    == PARENT EMPTY - Printing $sub_fields ==
    
    Array
    (
    )
    
    ============ end ============= 

    You might have also notice that the subfield['parent'] value is f. super weird since all it’s doing is assigning the field key to it which is displaying the correct value. I’m also not even sure how we are getting here on this last one because the array is clearly empty and we have this if statement to protect against this !empty($sub_fields).

    I’m was thinking the way it’s cutting off on the subfield parent maybe it was due to that max_input_var limit in php, I upped that to 3000 and still getting the same results. I’m running php 7.1, any ideas?