• Resolved charliejustus

    (@charliejustus)


    Hi there, I seem to be getting this weird error message in the admin section of a custom post when I set up the meta box using your online generator.

    Screenshot

    Here’s the code:

    function venue_get_meta_box( $meta_boxes ) {
    	$prefix = 'prefix-';
    
    	$meta_boxes[] = array(
    		'id' => 'venue-meta-box',
    		'title' => esc_html__( 'Venue', 'wtf-events' ),
    		'post_types' => array('wtf-events' ),
    		'context' => 'side',
    		'priority' => 'default',
    		'autosave' => 'false',
    		'fields' => array(
    			array(
    				'id' => $prefix . 'venue',
    				'type' => 'text',
    				'name' => esc_html__( 'Venue', 'wtf-events' ),
    			),
    			array(
    				'id' => $prefix . 'venue-image',
    				'type' => 'image_select',
    				'name' => esc_html__( 'Venue Image', 'wtf-events' ),
    				'force_delete' => 'false',
    				'max_file_uploads' => '1',
    			),
    			array(
    				'id' => $prefix . 'venue-link',
    				'type' => 'url',
    				'name' => esc_html__( 'Venue Link', 'wtf-events' ),
    			),
    		),
    	);
    
    	return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'venue_get_meta_box' );
Viewing 1 replies (of 1 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @charliejustus ,

    Thanks for your feedback. The “image_select” field requires a parameter “options” which accepts an array of (value => URL), like this:

    array(
        'id' => $prefix . 'venue-image',
        'type' => 'image_select',
        'name' => esc_html__( 'Venue Image', 'wtf-events' ),
        'force_delete' => 'false',
        'max_file_uploads' => '1',
        'options' => array(
            'a' => 'http://url-to-1st-image.jpg',
            'b' => 'http://url-to-2nd-image.jpg',
        ),
    ),

    If you use our online generator, make sure you click the “+ Option” to add these options.

    For more details, please see this documentation.

Viewing 1 replies (of 1 total)

The topic ‘Invalid argument’ is closed to new replies.