Support

Account

Home Forums General Issues Undefined index: key

Helping

Undefined index: key

  • Hello! I get next notice while using ACF: Undefined index: key on line 915 in file\www\wp-content\plugins\advanced-custom-fields\core\api.php
    This notice appeares on front and back end pages where I’m using conditional logic in custom fields. Here is my code for this fields:

    register_field_group(array (
                'id' => 'acf_video',
                'title' => 'Video',
                'fields' => array (
                    array (
                        'layout' => 'horizontal',
                        'choices' => array (
                            'youtube' => 'Youtube',
                            'vimeo' => 'Vimeo',
                            'none' => 'None',
    
                        ),
                        'default_value' => 'none',
                        'key' => 'field_51dcec694fdf79',
                        'label' => __('Video type','EPB'),
                        'name' => 'video_type',
                        'type' => 'radio',
                    ),
                    array (
                        'default_value' => '',
                        'formatting' => 'html',
                        'key' => 'field_51dcedb44fdfa1',
                        'label' => __('Video ID','EPB'),
                        'name' => 'video_id',
                        'type' => 'text',
                        'conditional_logic' => array (
                            'status' => 1,
                            'rules' => array (
                                array (
                                    'field' => 'field_51dcec694fdf79',
                                    'operator' => '==',
                                    'value' => 'youtube',
                                ),
                                array (
                                    'field' => 'field_51dcec694fdf79',
                                    'operator' => '==',
                                    'value' => 'vimeo',
                                ),
                            ),
                            'allorany' => 'any',
                        ),
                    ),
                    array (
                        'conditional_logic' => array (
                            'status' => 1,
                            'rules' => array (
                                array (
                                    'operator' => '==',
                                    'value' => 'none',
                                ),
                            ),
                            'allorany' => 'all',
                        ),
                    ),
    
                ),
                'location' => array (
                    array (
                        array (
                            'param' => 'post_type',
                            'operator' => '==',
                            'value' => 'gg_slider',
                            'order_no' => 0,
                            'group_no' => 0,
                        ),
                    ),
                ),
                'options' => array (
                    'position' => 'normal',
                    'layout' => 'default',
                    'hide_on_screen' => array (
                    ),
                ),
                'menu_order' => 0,
            ));

    Will be appreciate for any help. Thanks.

  • Problem solved. Conditional logic is not a field of field group.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Undefined index: key’ is closed to new replies.