image-select error

Support General image-select errorResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #22020
    davidrknowlesdavidrknowles
    Participant

    I am getting an error on the custom fields image select field. it seems to be an issue in rendering the field:

    Notice: Undefined index: options in /.../public_html/wp-content/plugins/meta-box/inc/fields/image-select.php on line 32
    
    Warning: Invalid argument supplied for foreach() in /.../public_html/wp-content/plugins/meta-box/inc/fields/image-select.php on line 32
    Thumb Image
    #22021
    davidrknowlesdavidrknowles
    Participant

    The metabox looks like this:

    ?php
    
    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'      => esc_html__( 'drk-content', 'text-domain' ),
            'id'         => 'drk-content',
            'post_types' => ['post'],
            'context'    => 'side',
            'priority'   => 'high',
            'fields'     => [
                [
                    'id'       => $prefix . 'thumb-image',
                    'type'     => 'image_select',
                    'name'     => esc_html__( 'Thumb Image', 'text-domain' ),
                    'desc'     => esc_html__( 'Thumb image for grid feature', 'text-domain' ),
                    'required' => 1,
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    #22024
    Long NguyenLong Nguyen
    Moderator

    Hi David,

    The field image_select requires the setting options which uses to "select". For more information, please follow the documentation https://docs.metabox.io/fields/image-select/#settings.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.