Home › Forums › General Issues › Filter Relationship Field Query › Reply To: Filter Relationship Field Query
There isn’t anything that will allow you to filter a relationship field based on a selection made in another field. The value of the other field is not available for the acf/fields/relationship/query/
filter, it is not supplied by ACF when it runs the AJAX request to get the posts.
There are a couple of possibilities.
1) is that you must save the post before you can filter based on this other field. Then in your filter that you posted above
'value' => get_field('filter_field_name', $post_id)
2) Do not use a relationship field and switch to a select field and add custom JavaScript and your own AJAX query to get the posts. There are some examples of this here https://github.com/Hube2/acf-dynamic-ajax-select-example
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.