Custom Fields
Re-Envisioned
Support General image-select error

  • Creator
    Topic
  • #22020
    Resolved davidrknowles
    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
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #22021
    davidrknowles
    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 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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.