Support

Account

Home Forums Bug Reports acf-field-functions.php:349 – Undefined index: key Reply To: acf-field-functions.php:349 – Undefined index: key

  • @codaboor This is the file I changed in the plugin advanced-custom-fields-pro/includes/acf-field-functions.php

    ORIGINAL

    
    // Check local fields first.
    if( acf_have_local_fields($parent['key']) ) {
    	$raw_fields = acf_get_local_fields( $parent['key'] );
    	foreach( $raw_fields as $raw_field ) {
    		$fields[] = acf_get_field( $raw_field['key'] );
    	}
     	
    // Then check database.
    } else {
    	$raw_fields = acf_get_raw_fields( $parent['ID'] );
    	foreach( $raw_fields as $raw_field ) {
    		$fields[] = acf_get_field( $raw_field['ID'] );
    	}
    }
    

    MODIFIED

    
    if ( isset( $parent['key'] ) && isset( $parent['ID'] ) ) {
    
    	// Check local fields first.
    	if( acf_have_local_fields($parent['key']) ) {
    		$raw_fields = acf_get_local_fields( $parent['key'] );
    		foreach( $raw_fields as $raw_field ) {
    			$fields[] = acf_get_field( $raw_field['key'] );
    		}
    
    	// Then check database.
    	} else {
    		if ( isset( $parent['ID'] ) ) {
    			$raw_fields = acf_get_raw_fields( $parent['ID'] );
    			foreach ( $raw_fields as $raw_field ) {
    				$fields[] = acf_get_field( $raw_field['ID'] );
    			}
    		}
    	}
    }