Let plugin check if taxonomy is already registered by another plugin

The problem is that the function is defined whether you use it or not. What you want is the PHP function function_exists if ( !taxonomy_exists( ‘my_taxonomy’ ) && !function_exists(‘register_taxonomy_my_taxonomy’) ) { add_action( ‘init’, ‘register_taxonomy_my_taxonomy’ ); function register_taxonomy_my_taxonomy() { … } You should be able to create a reusable library (class) that would take care of … Read more

I can’t access custom taxonomy page listing

The only problem that I have found is ‘query_var’ => ‘news’ in register_taxonomy(). Change it to ‘query_var’ => true and it will start working. function create_my_taxonomies() { register_taxonomy( ‘news_categories’, ‘news’, array( ‘labels’ => array( ‘name’ => ‘News Categories’, ‘add_new_item’ => ‘Add New Category’, ‘new_item_name’ => “New Category” ), ‘query_var’ => true, ‘show_ui’ => true, ‘show_tagcloud’ … Read more

What is the action hook that deletes a taxonomy term from the backend? And how to retireve the term id before deleting it?

Actually, you can use multiple actions, at least this is what at the end of the wp_delete_term function, which runs when you click Delete on a taxonomy term: do_action( ‘delete_term_taxonomy’, $tt_id ); do_action( ‘deleted_term_taxonomy’, $tt_id ); do_action( ‘delete_term’, $term, $tt_id, $taxonomy, $deleted_term ); do_action( “delete_$taxonomy”, $term, $tt_id, $deleted_term ); The last one my be the … Read more

Get object for a few selected taxonomies

I am not aware of a function to get only specific term objects for a post type but it is not hard to filter out the ones you want. For example: $taxonomies = get_object_taxonomies( ‘post’, ‘objects’ ); $taxonomies = array_intersect_key($taxonomies,array_flip(array(‘category’,’post_tag’))); var_dump($taxonomies); But since you know the taxonomies you want, you could also just use get_taxonomy( … Read more

Hide meta box for everything BUT a certain custom post type

Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? http://codex.wordpress.org/Function_Reference/register_taxonomy register_taxonomy( ‘my_custom_post_type_tags’, ‘my_custom_post_type’, array( ‘label’ => __( ‘Tags’ ), ‘rewrite’ => false, ‘hierarchical’ => false, ‘capabilities’ => array( ‘edit_terms’ => ‘manage_categories’ ) ) );