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

William P. Davis will.davis at gmail.com
Wed Dec 15 17:13:17 UTC 2010


Thanks Mo!

On Wed, Dec 15, 2010 at 11:51 AM, Mohammad Jangda <batmoo at gmail.com> wrote:
> 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' );
>
>  }
>
> }
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list