Support

Account

Home Forums Backend Issues (wp-admin) Changing query of Post Object field upon changing the field Reply To: Changing query of Post Object field upon changing the field

  • First you would need to add custom JavaScript. The basics are covered here https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/

    Using the new JS API for ACF you would create a filter using this hook https://www.advancedcustomfields.com/resources/javascript-api/#filters-select2_args. In this filter you would get the values of the other relationship field and add them to the ajax data being sent. You would do this using the field functions https://www.advancedcustomfields.com/resources/javascript-api/#acf.field.

    Finally you would create the acf/fields/post_object/query filter that would use the information to filter the posts using the new data that is sent, more than likely by adding a post__not_in argument.

    Sorry I can’t be more specific or give you example code, but I don’t have more at the moment.