Custom Save Field - rogerlos/cmb2-metatabs-options GitHub Wiki

CMO includes a new field type for CMB2, allowing you to add a save button to a metabox.

When you click any save button on a CMO options page, all values, including those in tabs not visible at the moment, are saved. It's OK to have multiple save buttons (for example, you want to add one to the final metabox in each tab).

By default, CMO adds a save button at the bottom of the options page. You can hide that button by setting the savetxt configuration argument to be an empty string.

This field is extremely simple when configuring:

$cmb->add_field( array(
    'name'       => __( 'Publish?', 'cmb2' ),
    'desc'       => __( 'Save Options' ),
    'id'         => 'my_save_button',
    'type'       => 'options_save_button',
));

Whatever text you place in the 'desc' key will show up as text on your save button.