Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?

As of v1.3, the Query Multiple Taxonomies plugin works great with WP_Query. Your original args work as is. $args = array( ‘post_type’ => ‘portfolio’, ‘numberposts’ => -1, ‘project_type’ => ‘A’, ‘package’ => ‘A’ ); Then make a new query and check it: $foo = new WP_Query($args); var_dump($foo->posts); I tested this on my own custom taxonomy … Read more

Is there a way to ‘Lock’ a Taxonomy?

Categories, Tags & Taxonomies First i want to make this one clear: Everything is a Taxonomy. Tags is a non-hierarchical, Categories a hierarchical and both are built-in taxonomies. Same goes for eg. post formats (aside, chat, etc.). It’s the same concept as with post-types (post, page, attachment, nav_menu_item, etc. are all just built in post … Read more

Exclude Specific Term from Search

The basic explanation You have a template tag that is called is_search() to determin if you’re on a search page or not. This then calls get_search_template() which basically is a wrapper function for get_query_template(‘search’). When you look into the last function, then you’ll see that it basically does locate_template(), which checks for file existence and … Read more

Combining Multiple Taxonomies in one URL

This rewrite rule should work (assuming “brand” and “type” are the taxonomy registered names): function custom_rewrite_rules() { add_rewrite_rule(‘^brand/(.*)/type/(.*)?’, ‘index.php?brand=$matches[1]&type=$matches[2]’, ‘top’); } add_action(‘init’, ‘custom_rewrite_rules’); Remember to flush the rewirte rules after saving this code in your site. Then you will need to hook in several places to fix things. For example, you may need to hook … Read more

Determine Term depth

Not trying to bump my rep, but I found my own answer. get_ancestors allows you to get the hierarchy of any item. Since terms can only have 1 parent, this is all we need: the number of items in this list equates to the term depth level, and even provides term ids. Usage: $ancestors = … Read more

Can custom taxonomies be displayed inside of a custom meta box?

The following is taken from a “move author to publish box” task, but it should give you a starting point. Next you should take a look at “/wp-admin/edit-form-advanced.php” where you’ll find something about get_object_taxonomies() to see how your stuff get’s named, so you can remove and add stuff. function wpse_remove_author_box() { if ( ! is_admin() … Read more

Custom Taxonomy as Dropdown in admin

This suppose you have a custom post type “sponsors” and a custom taxonomy “types”… function custom_meta_box() { remove_meta_box( ‘tagsdiv-types’, ‘sponsors’, ‘side’ ); add_meta_box( ‘tagsdiv-types’, ‘Types’, ‘types_meta_box’, ‘sponsors’, ‘side’ ); } add_action(‘add_meta_boxes’, ‘custom_meta_box’); /* Prints the taxonomy box content */ function types_meta_box($post) { $tax_name=”types”; $taxonomy = get_taxonomy($tax_name); ?> <div class=”tagsdiv” id=”<?php echo $tax_name; ?>”> <div class=”jaxtag”> … Read more