Field Type: post - filter query args by external fields

Support General Field Type: post - filter query args by external fields

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #20946
    Austin PassyAustin Passy
    Participant

    I've seen a few questions around this topic, but unsure if it's been solved.

    Basically without knowing the specific query_arg (WP_Query) array data, there isn't an easy way to filter a post selector field type.

    A simple scenario:
    Three Custom Post Types: author, book, collection.
    Books have a meta_key of author tied to author post IDs.

    • In Collection add two fields; selector for author & selector for book (maybe book is a multi-selector or is clonable).
    • We want to filter the book field by author (but want it dynamically filtered by selecting the author from the author field (could be single or multi-selector).

    I would like to add a note that I have build a simple working version of this in javascript, but it's limited to a few scenarios, and as I dive deeper into selection that filter a field by post_type, taxonomy, or multi selectors (in a repeater group) the basic function I built becomes moot.

    I'd like to avoid conditional logic fields, since it still wouldn't cover knowing the selections of what I am calling the field filter selectors.

    Anyone build something like this? Does this seem like a custom field type?

    #20947
    Austin PassyAustin Passy
    Participant

    Kinda seems like I just explained a custom field type like relationship in ACF: https://www.advancedcustomfields.com/resources/relationship/

    #20949
    Long NguyenLong Nguyen
    Moderator

    Hi Austin,

    We have the extension MB Relationships which can help you to cover your case. It's free so you can try to create the relationship between post types and filter posts by WP_Query.

    Follow this documentation for more information https://docs.metabox.io/extensions/mb-relationships/.

    #20954
    Austin PassyAustin Passy
    Participant

    I was afraid you point that out, and that's not what I was getting at. I just linked up the ACF one because it's post field has two outside selectors that filter the actual post dropdown (in theirs it's by post_type and taxonomy.

    #20962
    Long NguyenLong Nguyen
    Moderator

    Hi Austin,

    I'm going to create a feature request and discuss it with the developer team to support more options for the relationship.

    Thank you and have a nice day.

    #20965
    Austin PassyAustin Passy
    Participant

    Thanks. I am working on an implementation, and if I feel it's not too hacky, I will share it here.

    Maybe let's not call it a relationship, but, "dynamic/external post query arg controls".

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