Home Forums ACF PRO Reciprocal relationships – reusable function


Reciprocal relationships – reusable function

  • I’m using the outstanding acf-reciprocal-relationship.php by John Huebner and it’s working really well. Kudos to him for writing that!

    I’m now at the point where I want to roll out these reciprocal relationships across multiple post types, and so would like to move the hardcoded $key_a and $key_b variables outside the acf_reciprocal_relationship() function so it can be reused with variables passed in each time I use the add_filter() function.

    Using the the acf/update_value/key= filter, is it possible to pass in multiple keys like a query string? Perhaps I could pass in something like acf/update_value/key=field_5b310e28be9c2&field_5b310e28be9c3 and then try to parse the long key into two inside the function? Any better ideas?


  • I figured a way to do this by fumbling my way through the concept of PHP closures.

    I created a pull request which you can see here.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Reciprocal relationships – reusable function’ is closed to new replies.