Custom Fields
Re-Envisioned
Support Meta Box Builder How to filter post select field by metabox custom field?

  • Creator
    Topic
  • #18377
    Resolved Rick
    Participant

    I have 3 post types Book, Author, Character.

    I have characters that have a value “author” which is tied to an author post.

    Then I have a book post type, which is tied to an author through a post field. It also has a character field which is a post select field as well. I would like to limit that character dropdown showing on the books page to only those characters that are assigned to the same author as the current book. Is that possible? I tried everything possible I could think of in the Query values in the advanced tab, but couldn’t get anything to filter it.

    Any help would be very appreciated.

    Thanks!
    Rick

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

    Hi Rick,

    I think that can be done with some code. Meta Box Builder couldn’t help building complex queries.

    This is a pseudo code that can help you to start with:

    https://pastebin.com/hVnePVdN

    You might need to change the query to get the proper characters for you.

    #18405
    Rick
    Participant

    Thanks Anh, I’ll give it a shot.

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