Support » Plugin: CMB2 » WP 5.5 and Alternative Contexts

  • Resolved ylkyrg

    (@ylkyrg)


    As of WP 5.5 meta boxes with alternative contexts (after_title, etc.) are not displayed correctly.

    Possibly related to the addition of keyboard controls to order meta boxes.

    >=WP 5.5
    Classic Editor
    CMB2 (develop branch)

    add_action( 'cmb2_admin_init', 'cmb2_sample_metaboxes' );
    
    function cmb2_sample_metaboxes() {
    
    	$cmb = new_cmb2_box(
    		array(
    			'id'           => 'test_metabox',
    			'title'        => __( 'Test Metabox', 'cmb2' ),
    			'object_types' => array( 'page' ),
    			'context'      => 'after_title',
    			'priority'     => 'high',
    			'show_names'   => true,
    
    		)
    	);
    
    	$cmb->add_field(
    		array(
    			'name'       => __( 'Test Text', 'cmb2' ),
    			'desc'       => __( 'field description (optional)', 'cmb2' ),
    			'id'         => 'yourprefix_text',
    			'type'       => 'text',
    			'show_on_cb' => 'cmb2_hide_if_no_cats',
    
    		)
        );
    }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.