Custom Post Types as Taxonomies

This may not be a roots specific question but I feel this is a great place for development suggestions.

I need to post type called Articles. In that post type I need to add the option to select an Author (the actual articles author) which is also a custom post type.

The reason Author must be a post type and not a taxonomy is because the Author has more info attached to it such as email, address, etc.

So my questions are:

  • Is there any way to have the Author post types appear in the Article posts as a taxonomy?

The other way I was thinking of accomplishing this is adding an Advanced Custom Fields Post Object to the Articles that the user could select the Author form a list.

I’m not opposed to setting it up with ACF, but I’m just thinking down the line and running into possible issues with search functions.

Any feedback is appreciated!

Sounds like you need Posts 2 Posts.

Posts 2 Posts is great, but just to add to discussion another option although it may not be suited for your project.

ACF lets you create custom fields on taxonomy objects as well, so you could in theory create an ‘Author’ tax and add the extra email and address fields.

1 Like

@chriscarr, interesting plugin. Thanks!

@enollo, I like that option. I think this is what you’re referring to.

If I can accomplish the same results with the tools I’m already using (ACF) that would be an ideal solution.

While you can use that as an alternate UI to selecting the taxonomy (although ACF has something built in already) I was referring to the built in functionality.

When creating a field group select ‘Term’ from the ‘Show this field group if’ select drop down, then select your custom taxonomy. The ‘Term’ label is not very intuitive but once you think about it a little it starts to make sense :smile:

Then when adding or editing a term the custom fields you have created will show up above the submit button.

You can follow the ACF docs on how to get these values into your templates:

I think the section titled ‘Finding the term related to the current post’ is probably what you want.

I’d like to also note that Posts 2 Posts is a great plugin, but I have always tried to make something work with ACF before adding another plugin to the mix. Not because of the ‘too many plugins, too many problems’ myth, but simply to keep the UI consistent for my clients

1 Like

I have used this plugin for a few times now for this and it works great!

if this is a multiple author blog/site and it’s just the matter of adding fields for users to add extra info to their profiles maybe it’s best to use the default WordPress author functionality? you can use ACF to add extra fields you need on the user profile or some other methods to add new fields to the user profile: i’ve tried all of the 3 plugins and the are all great and can get the job done but i always try to use the built in WordPress solutions first if possible.

Wise words. Try ACF first then add another plugin if absolutely necessary. I too consider additional plugins as last resorts.

1 Like