October 16, 2017 at 2:26 pm
Hello!
Prior to the CMB update to CMB2, I had some custom metaboxes that depended on a theme extension. In my code, I had:
function bfc_remove_metaboxes() {
$options_slug = get_option(OPTIONS_SLUG);
if(isset($options_slug['bfc_staff_metabox']) && $options_slug['bfc_staff_metabox'] == '0') {
remove_filter( 'cmb_meta_boxes', 'bfc_current_courses_metaboxes', 60 );
}
}
add_action( 'after_setup_theme', 'bfc_remove_metaboxes', 1);
So if Current Courses was turned off, the additional metabox was hidden/removed (it worked well). After the update to CMB2, it no longer works. I tried changing it to:
function bfc_remove_metaboxes() {
$options_slug = get_option(OPTIONS_SLUG);
if(isset($options_slug['bfc_staff_metabox']) && $options_slug['bfc_staff_metabox'] == '0') {
remove_filter( 'cmb2_init_before_hookups', 'bfc_current_courses_metaboxes', 60 );
}
}
add_action( 'after_setup_theme', 'bfc_remove_metaboxes', 1);
But that doesn’t seem to work either. Can you help me? Some of our campuses don’t need this field and find it confusing so I’d like to choose when to show it.
On a side note, prior to the update, I also had a 'class' => 'double-arrows', as an option (that worked) but does not now. I tried changing it to ‘'classes' => 'double-arrows', but that didn’t work (I found the classes info on CMB2 docs but I’m guessing I did it wrong).
Can you help me with these? Thank you!