3

I'm looking for a plugin or suggestion on how to select a primary/main (custom taxonomy) term in a custom post type.

For example, I'm developing a Wordpress website for Musicians. I have a custom post type named "Releases", in "Releases", the user enters the information about a song (title, links, etc) and then selects an artist (or multiple artists) from the "Artists" taxonomy.

My goal is to output something like "Bob Dylan ft. The Band..." using something like get_the_terms();

I've already thought of having the user manually enter the primary artist (or secondary artists) I even thought of creating an duplicate taxonomy called (Primary Artist/Secondary)... Both of these solutions seem a bit redundant. Is their a plugin that would allow me to just keep it all in one taxonomy, having the user just select which artist is the primary?

1

There is no concept of "primary" term in WordPress. Taxonomies are grouping mechanism. Post belongs to multiple terms on equal terms (no pun intended). No term is "more" of a group than the rest.

From brief description of your use case, intuitively Artists would be much better defined as CPT too. But then it comes down to relationship between posts and WP doesn't do this either out of the box. Though there are staple plugins like Posts2Posts for it.

Overall I would recommend to put a bit more thought in architecture. When taxonomies are getting too elaborate it tends to be a bad sign for long term.

|improve this answer|||||
0

It's a little 2 years now. But I also found your question looking into the same thing.You can use the Yoast SEO Plugin for this. It helps one to add that core functionality as well as help you with touching up your Search engine optimization and other features.

These links gave me the answer Yoast SEO Plugin allows one to make primary categories Example is here how to use the code

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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