Custom Fields
Re-Envisioned
Support General Basic question about taxonomies vs CPT relationships

  • Creator
    Topic
  • #31275
    Resolved John
    Participant

    Hi,

    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
    John

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #31282
    Long Nguyen
    Moderator

    Hi,

    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/

    #31283
    John
    Participant

    Brilliant, 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
    John

    #31286
    John
    Participant

    Sorry 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 ?

    #31298
    Long Nguyen
    Moderator

    Hi 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.

    #31303
    John
    Participant

    Thanks. I'm going to use my own form and code to do it and create or edit the taxonomy on submit.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.