Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Let's say I have one custom taxonomy called "movies" and another called "actors". How to I link those two taxonomies so as to be able to determine which actors play in such and such movie, or which movie does such and such actors plays in ?

(I don't want to use custom post types, only taxonomies)

share|improve this question
You want to be able to click an actor and have it list all of the movies he plays in? – xLRDxREVENGEx Jun 3 '11 at 17:36
Yes and vice versa (click on a movie and have it list all of the actors it features) – Mike Jun 3 '11 at 17:51
What types of posts will these taxonomies be used with? – tnorthcutt Jun 3 '11 at 18:34
2  
Why are you unwilling to use post type? In what you are describing movies, if not actors, really should be a post type. Perhaps you might get a better answer if we understood what you were actually trying to accomplish... – mattrepublic Jun 3 '11 at 21:45
1  
@Mike There is no direct way to link two custom taxonomies in the fashion that you are looking for. You can indirectly link two taxonomies by creating a taxonomy archive page for one taxonomy and inserting a loop for the other taxonomy in that template. It would be much simpler for you to use a standard post with a Quote post format. – mattrepublic Jun 5 '11 at 14:14
show 4 more comments

closed as too localized by toscho Jul 5 '12 at 21:14

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

the func to add a post to a taxonomy can be used here.

            wp_set_post_terms($post->ID, $term->term_id, $taxonomy, true);

So in your case to move 'actors' to 'movies', get the actor (post_id) and call:

wp_set_post_terms($post_id, $term_id, "movies", true);

Now post_id is in two taxonomies, the original 'actors' and the new 'movies'

hope this helps ;)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.