OK so I generated this metabox which will be included in my theme:
function themename_page_options_metabox( $meta_boxes ) {
$prefix = 'themename_';
$meta_boxes[] = array(
'id' => 'page-options',
'title' => esc_html__('Hide Stuff','themename'),
'post_types' => array('post','page'),
'context' => 'side',
'priority' => 'default',
'autosave' => true,
'fields' => array(
array(
'id' => $prefix . 'hide_stuff',
'name' => esc_html__('Hide This','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
),
);
return $meta_boxes;
}
add_filter('rwmb_meta_boxes','themename_page_options_metabox');
So after they install the theme, they use a plugin that will add more choices. How would I overwrite the filter above to add more choices when the plugin is added and activated, like this:
function themename_page_options_metabox( $meta_boxes ) {
$prefix = 'themename_';
$meta_boxes[] = array(
'id' => 'page-options',
'title' => esc_html__( 'Hide Stuff', 'themename' ),
'post_types' => array( 'post', 'page' ),
'context' => 'side',
'priority' => 'default',
'autosave' => true,
'fields' => array(
array(
'id' => $prefix . 'hide_this',
'name' => esc_html__('Hide This','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
array(
'id' => $prefix . 'hide_that',
'name' => esc_html__('Hide That','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
array(
'id' => $prefix . 'hide_and_the_other',
'name' => esc_html__('Hide This, That and the Other','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'themename_page_options_metabox' );