[wp-hackers] Limiting ability to add terms to taxonomies

Mohammad Jangda batmoo at gmail.com
Wed Dec 15 16:51:59 UTC 2010


On Tue, Dec 14, 2010 at 10:43 PM, William Davis <will.davis at gmail.com>wrote:

> My question is, is there an easy way to get an array of all the taxonomies
> that have meta boxes and unset those meta boxes?


You could either remove the metaboxes (see below -- though, it doesn't take
into account Quick Edit) or set show_ui to false by modifying the global
$wp_taxonomies object (though, this will likely have other side-effects).

// Modified from code in wp-admin/edit-form-advanced.php that adds meta
> boxes

$post_type = 'post';


> foreach ( get_object_taxonomies( $post_type ) as $tax_name ) {

 $taxonomy = get_taxonomy( $tax_name );

 if ( $taxonomy->show_ui ) {

 if ( ! is_taxonomy_hierarchical( $tax_name ) )

 remove_meta_box( 'tagsdiv-' . $tax_name, $post_type, 'side' );

 else

 remove_meta_box( $tax_name . 'div', $post_type, 'side' );

 }

}


More information about the wp-hackers mailing list