Home - rogerlos/cmb2-metatabs-options GitHub Wiki

CMB2 Metatabs Options (CMO) allows you to create WordPress options pages which can have multiple metaboxes and allow the optional use of WordPress admin tabs--which themselves can each have multiple metaboxes! Your options page can be a top-level menu in the WordPress admin, or a sub-menu of any other WordPress admin menu, including custom post types or pages.

CMO is intended for developers using CMB2 to manage metaboxes and fields. CMO requires the WordPress CMB2 Plugin or your project must use the CMB2 library.

To use as a plugin, simply install and activate.

To use as a class, copy the files within the "code" directory into your project. If you change the relationship of the JS file to the PHP file, you will need to inject or configure the jsuri property to point to the JS file.

CMB2 must be initialized before you can call CMO. Note that the very earliest you can add CMO (assuming CMB2 v2.2.1) via action is:

add_action( 'init', 'your_CMO_callback_function', 9992 );

CMB2 decrements the priority of the init action which initializes their class to prevent version conflicts; they are currently at priority 9991. You must also call CMO before the admin_init action, as that is called within the class itself.

You will need to set some argument values, but adding an options page is done by calling the class:

new Cmb2_Metatabs_Options( $args );

See the example and arguments pages for more details.