Custom Fields
Re-Envisioned
Support Meta Box Builder Using Conditional Logic with Taxonomies

  • Creator
    Topic
  • #13489
    Alex Mansfield
    Participant

    As far as I can tell (although I hope I’m wrong), it looks like meta boxes can be shown/hidden based on the value of a custom field, but not based on whether or not the post has a particular taxonomy term. Is that correct? I think I read about a way to do this with code, but I was really hoping to be able to do it from the Builder plugin. Is that possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #13529
    Anh Tran
    Keymaster

    Hi Alex,

    The Builder lacks of supporting for taxonomies for Conditional Logic at the moment. You can do that with Custom Attributes in the Advanced tabs. The attributes can be found in docs of Conditional Logic docs here: https://docs.metabox.io/extensions/meta-box-conditional-logic/#using-with-taxonomies

    #18558
    Mark Tenney
    Participant

    Anh, I have tried this, but it only seems to work if a taxonomy has been selected and saved to the post. I have been trying to show fields based on the selection of a taxonomy_advanced field before saving the post with no luck.

    #18571
    Anh Tran
    Keymaster

    Hi Mark,

    For taxonomy_advanced field, it works similar to any other field.

    You can use contains or in condition and both works. Remember to use term ID to specify the value.

    So, you can write the condition like this:

    'visible' => ['field_id', 'contains', 4], // 4 is the term ID
    

    Or:

    'visible' => ['field_id', 'in', [4, 2]], // 4, 2 are term IDs. In this case, the field will be visible if the tax_advanced has any term with the ID specified.
    

    Please see this video for demo:

    https://www.loom.com/share/091c1c8956044d599564f3f7417aea19

    #19746
    SteveCo
    Participant

    Hopefully we see a more visual way to select taxonomy terms (like hierarchical).

    #19930
    SteveCo
    Participant

    I need this feature too. Any update as to if it will be coming to Builder anytime soon?

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