Home › Forums › Front-end Issues › acf/fields/post_object/query in Block › Reply To: acf/fields/post_object/query in Block
This will work the same way whether using blocks or not using blocks.
To summerize and make sure I’m not missing anything.
You have two fields in your group
And you want to filter the posts available for selection in the post object field by the selected term.
This is not possible without custom coding. You will need to add custom JavaScript to ACF and you will need to use the ACF JS API.
In your JS code you will need to use the select2_ajax_data hook and get the value selected in the taxonomy field and add it to the values submitted in the AJAX request.
Then in your acf/fields/post_object/query filter you will need to get this value from $_POST and use the value to alter the query done for the post object field.
You may also need to trigger a refresh of the post object field or delete any value that is already selected in the post object field if the term selected in the taxonomy field is changed. I don’t have any references on how to do this part.
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.