How to add a default item to a custom taxonomy?

Have a look here: https://web.archive.org/web/20150403012347/http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/ Basically what you need to do is use the save_post hook to check the terms for the post and add the default term from your taxonomy if it’s empty. If you just want to have an initial term set in your custom taxonomy, then you can use wp_insert_term(). Probably easiest … Read more

Get the first post term

I’m not sure what you mean by ‘first’ taxonomy… but, $terms = get_the_terms( $post->ID, ‘mytaxonomy’ ); returns an array of taxonomy term objects, so $term = array_pop($terms); Would give you the first term in the array. And then: echo ‘<a href=”‘.get_term_link($term->slug, ‘mytaxonomy’).'”>’.$term->name.'</a>,’ (You may want to include some if statements, in case an empty array … Read more

How to change permalink structure for custom post type and it’s taxonomies?

Ok I think I might have a solution. I have no idea if this is the right way to accomplish this, but as for now it’s the only thing that seems to work. add_filter(‘rewrite_rules_array’, ‘mmp_rewrite_rules’); function mmp_rewrite_rules($rules) { $newRules = array(); $newRules[‘portfolio/(.+)/(.+?).html$’] = ‘index.php?project=$matches[2]’; $newRules[‘portfolio/(.+)/?$’] = ‘index.php?project_category=$matches[1]’; return array_merge($newRules, $rules); } add_filter(‘request’, ‘mmp_rewrite_request’); function mmp_rewrite_request($vars) … Read more

Custom taxonomy list page?

There is nothing built-in to WordPress to provide an “index” page for your taxonomy as your question implies there should be (and I agree, there should be! But there isn’t.) Instead you have to hack it and one way to do that is to create a page called “Main Ingredient” with a main-ingredient URL slug … Read more