Support

Account

Home Forums Backend Issues (wp-admin) acf/load_field not displaying values Reply To: acf/load_field not displaying values

  • Sorry, it’s a lot of code, but thank you for your time. I don’t know the best way to share it, but hopefully this is okay.

    I’m using this filter:

    add_filter('acf/load_field/key=field_604de6ee3ffc6', 'acf_load_post_type_groups');

    to add subfields to a field of type “Group” (because I need them to be dynamic).

    Here is the group field:

    acf_add_local_field_group(array(
    	'key' => 'group_604dda92ef574',
    	'title' => 'Archives',
    	'fields' => array(
    		array(
    			'key' => 'field_604de6ee3ffc6',
    			'label' => 'Archives',
    			'name' => 'archive_options',
    			'aria-label' => '',
    			'type' => 'group',
    			'instructions' => 'Archive pages are lists such as the main blog page, search results, and category and tag pages. Choose layout, appearance, and other options for such pages from the list below for each post type.',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'layout' => 'block',
    			'acfe_seamless_style' => 0,
    			'acfe_group_modal' => 0,
    			'acfe_group_modal_close' => 0,
    			'acfe_group_modal_button' => '',
    			'acfe_group_modal_size' => 'large',
    			'sub_fields' => '',
    		),
    	),
    	'location' => array(
    		array(
    			array(
    				'param' => 'options_page',
    				'operator' => '==',
    				'value' => 'theme-options',
    			),
    		),
    	),
    	'menu_order' => 10,
    	'position' => 'normal',
    	'style' => 'seamless',
    	'label_placement' => 'top',
    	'instruction_placement' => 'label',
    	'hide_on_screen' => '',
    	'active' => true,
    	'description' => '',
    	'show_in_rest' => 0,
    	'acfe_display_title' => '',
    	'acfe_autosync' => '',
    	'acfe_form' => 0,
    	'acfe_meta' => array(
    		'604dddb8749bf' => array(
    			'acfe_meta_key' => '',
    			'acfe_meta_value' => '',
    		),
    	),
    	'acfe_note' => '',
    ));

    The ‘sub_fields’ => ”, part is getting loaded from a function in functions.php using that filter.

    Here’s the function:

    (ATTACHMENT-1)

    Here’s what I get when I look at the php that is being generated by ACF:

    (ATTACHMENT-2)

    And here’s how it looks on my Theme Options page:

    archive-options-page

    Each post type has the same set of options. Everything else on the options page is saving just fine, but not this stuff.

    My fields are getting generated but nothing is saving. I originally said that it was saving to the database, but it’s not now.

    The database looks kind of weird, too:

    acf-database-rows

    Any idea what I’m doing wrong? I assume there’s something seriously wrong with that function even though the fields are getting generated.