Home Forums Backend Issues (wp-admin) Dynamically populate relationship field Reply To: Dynamically populate relationship field

  • You cannot modify the choices of a relationship field by using a load field filter. These can really only be modified by using the method you mentioned

    On a taxonomy page, or any page, ACF sends the current post ID as part of the request. I just did a test and here is what is in the $_POST array for the request.

        [paged] => 1
        [taxonomy] => 
        [post_type] => 
        [s] => 
        [max] => 
        [min] => 
        [action] => acf/fields/relationship/query
        [field_key] => field_587ba38bc815c
        [post_id] => category_4
        [nonce] => b12e5fd166

    In your acf/fields/relationship/query filter you can look at the post_id value. From this you can get the taxonomy and the term ID. You can then use these values to modify the query args you return from your filter so that only posts in the current term are returned.