Change $prefix = '_yourprefix_';
to $prefix = '_wp';
or add the code below directly to functions.php
add_action( 'cmb2_admin_init', 'register_testimonial_metabox' );
function register_testimonial_metabox() {
$prefix = '_wp';
$cmb_demo = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => __( 'Homepage Custom Fields', 'cmb2' ),
'object_types' => array( 'page', ), // Post type
'show_on' => array( 'id' => array( 10, ) ),
) );
$cmb_demo->add_field( array(
'name' => __( 'Testimonial Author', 'cmb2' ),
'desc' => __( 'Who is the testimonial from', 'cmb2' ),
'id' => $prefix . 'author',
) );
$cmb_demo->add_field( array(
'name' => __( 'Testimonial', 'cmb2' ),
'desc' => __( 'add the testimonial here', 'cmb2' ),
'id' => $prefix . 'testimonial',
'type' => 'wysiwyg',
'options' => array( 'textarea_rows' => 5, ),
) );
$cmb_demo->add_field( array(
'name' => __( 'Author Image', 'cmb2' ),
'desc' => __( 'Upload an image or enter a URL.', 'cmb2' ),
'id' => $prefix . 'image',
'type' => 'file',
) );
}