Basic question about taxonomies vs CPT relationships
- This topic has 5 replies, 2 voices, and was last updated 3 years, 6 months ago by
John.
-
AuthorPosts
-
October 12, 2021 at 11:15 PM #31275
John
ParticipantHi,
I'm writing an app that is basically a collection of publications, each with a collection of articles (effectively a blog network).
Each user can own one publication. Each publication can have multiple articles (articles are CPT).
At first I set it up with the publication as a taxonomy. But now I've gone to add extra fields to it (such as description, image etc), I'm struggling to get it to work. The same code works fine for creating a metabox for the article CPT.
Is this a totally stupid way of doing it?
Should I use Metabox Relationships instead and create a CPT for the publication and link them to the articles CPT instead?
Thanks
JohnOctober 13, 2021 at 10:33 AM #31282Long Nguyen
ModeratorHi,
Use the publication as a taxonomy is a good way for your case. WordPress supports more functions to get the taxonomy and is easier than using a relationship.
To add extra fields to the taxonomy, you can use the extension MB Term Meta
https://docs.metabox.io/extensions/mb-term-meta/October 13, 2021 at 10:46 AM #31283John
ParticipantBrilliant, thanks Long. I thought it was the right way originally - and I am already using MB Term Meta - but then I had a wobble because when it came to adding the custom fields in code I was trying to do it exactly the same as with a CPT. I'd simply forgotten to look at the MB Term Meta documentation again.
Obviously this is my fault, but if I have one issue with working with MetaBox it's the fact so much is split over so many different plugins and I find it hard to remember to look in the right place to find something when, to my mind, it's all part of the same system but documentation-wise it's in different places.
Thanks so much, I thought I'd have to redo a lot of work - but now I just need to make that " 'taxonomies' => 'category', " change to my code basically!
Best wishes
JohnOctober 13, 2021 at 11:55 AM #31286John
ParticipantSorry Long, but is it possible to display/edit the custom taxonomies on the front end using Frontend Submission? So far it doesn't seem to work and a search of the forum seems to suggest that, at least as of last year, it wasn't possible.
This is something users need to set themselves. Am I better using MB User Meta for the front end form and then creating/editing the taxonomies in a post save filter ?
October 13, 2021 at 9:44 PM #31298Long Nguyen
ModeratorHi John,
The taxonomy and term meta are not supported to create or edit on the frontend. You can try to use the extension MB Relationships so you can create posts on the frontend and select the relation posts as well.
October 13, 2021 at 10:16 PM #31303John
ParticipantThanks. I'm going to use my own form and code to do it and create or edit the taxonomy on submit.
-
AuthorPosts
- You must be logged in to reply to this topic.