Hi I am building multiple sites for my work. All sites will take advantage of CPTs
and Custom Taxonomies
. Registered taxonomies will be handled using the Advanced Custom Fields
plugin. Therefore, I would like to remove all taxonomy meta boxes from all potential sites. I know I can do this via the following:
function my_remove_meta_boxes() {
remove_meta_box( 'tax-1div', 'CPT-1', 'side' );
remove_meta_box( 'tax-2div', 'CPT-1', 'side' );
remove_meta_box( 'tax-3div', 'CPT-1', 'side' );
remove_meta_box( 'tax-4div', 'CPT-1', 'side' );
remove_meta_box( 'tax-5div', 'CPT-1', 'side' );
}
add_action( 'admin_menu', 'my_remove_meta_boxes' );
But this would only remove said meta boxes from defined CPT-1
and not all potential CPT combinations. To remove from all potential CPTs I would have to do this:
function my_remove_meta_boxes() {
remove_meta_box( 'tax-1div', 'CPT-1', 'side' );
remove_meta_box( 'tax-2div', 'CPT-1', 'side' );
remove_meta_box( 'tax-3div', 'CPT-1', 'side' );
remove_meta_box( 'tax-4div', 'CPT-1', 'side' );
remove_meta_box( 'tax-5div', 'CPT-1', 'side' );
remove_meta_box( 'tax-1div', 'CPT-2', 'side' );
remove_meta_box( 'tax-2div', 'CPT-2', 'side' );
remove_meta_box( 'tax-3div', 'CPT-2', 'side' );
remove_meta_box( 'tax-4div', 'CPT-2', 'side' );
remove_meta_box( 'tax-5div', 'CPT-2', 'side' );
}
add_action( 'admin_menu', 'my_remove_meta_boxes' );
Is there a more efficient way to do this other than by de-registering all meta boxes for all CPTs?