Support

Account

Home Forums Bug Reports Fetching value from cloned field in acf/load_field filter Reply To: Fetching value from cloned field in acf/load_field filter

  • Hi @acf-support ,

    I´ve been testing some more and tried recreating all field groups, manually from scratch on a fresh install.

    • WP 4.6.1
    • ACF PRO 5.4.4
    • No other plugins

    The same error appears here too.

    The contents of the field global_quotes is set through the options page Theme settings.

    The error only seems to appear if there are values in the global_quotes field

    The filter for acf/load_field which populates the global_quotes_select:

    add_filter( 'acf/load_field/name=global_quotes_select', function( $field ) {
    
    	$global_quotes = get_field( 'global_quotes', 'option' );
    
    	if ( ! $global_quotes ) {
    		return $field;
    	}
    
    	foreach ( $global_quotes as $i => $quote ) {
    		$field['choices'][ $i ] = $quote['quote'];
    	}
    
    	return $field;
    
    });

    The Options page for Theme Settings:

    if ( function_exists( 'acf_add_options_page' ) ) {
    	acf_add_options_page([
    		'page_title' => __( 'Theme Settings', 'wptest' ),
    		'menu_title' => __( 'Theme Settings', 'wptest' ),
    		'menu_slug' => 'wptest_options',
    		'capability' => 'manage_options',
    		'redirect' => false,
    		'icon_url' => 'dashicons-welcome-widgets-menus',
    		'position' => 25,
    	]);
    }

    I´ve attached all three json-files needed to replicate the error. Could You please try and create everything manually the way I did?

    Thanks in advance.