• Resolved cullachie

    (@cullachie)


    Is it possible to set the default value, in the following code to “Royal Mail” please.

    Your help would be much appreciated.

    $cmb->add_field( array(
    	'name' => '-',
    	'id' => 'tracking_url',
    	'type' => 'radio',
    	'show_option_none' => true,
    	'options' => array(
    	'https://www.royalmail.com/track-your-item#/' => __( 'Royal Mail', 'cmb2' ),
    	'https://www.parcelforce.com/TRACK-TRACE/' => __( 'Parcel Force', 'cmb2' ),
    	'https://www.myhermes.co.uk/track#/' => __( 'Hermes', 'cmb2' ),
    	'https://www.ups.com/WebTracking/' => __( 'UPS', 'cmb2' ),
    ),
    ) );
Viewing 1 replies (of 1 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Unless I’m mistaken somehow, should be able to be done like so. Note the last line.

    $cmb->add_field( array(
    	'name' => '-',
    	'id' => 'tracking_url',
    	'type' => 'radio',
    	'show_option_none' => true,
    	'options' => array(
    		'https://www.royalmail.com/track-your-item#/' => __( 'Royal Mail', 'cmb2' ),
    		'https://www.parcelforce.com/TRACK-TRACE/' => __( 'Parcel Force', 'cmb2' ),
    		'https://www.myhermes.co.uk/track#/' => __( 'Hermes', 'cmb2' ),
    		'https://www.ups.com/WebTracking/' => __( 'UPS', 'cmb2' ),
    	),
    	'default' => 'https://www.royalmail.com/track-your-item#/'
    ) );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Set default for “Select” dropdown’ is closed to new replies.