Home Forums ACF PRO Add a relationship dynamically


Add a relationship dynamically

  • Hi all

    Quick question…

    My use case is that I have a custom post type (Project) that I’m adding “Sessions” to. So I add a “Project” and then I add “Sessions” through a client-side interface.

    I can create a “Session” using the WPAPI but I want to automatically populate an ACF field on the “Session” with the “Project” ID in a relationship field. I am using acf_Form() on the front end.

    Is there a way to do this? Currently I’ve tried adding through the API and also targeting the field on the front end using javascript but it’s quite buried and the values for a relationship field aren’t all in one input.

    Any help VERY much appreciated.


  • OK, sorted this.

    I still don’t see a way of doing this via the API without using the third-party plugin which seems to be unmaintained. Am I missing something? Is this something in development?

    I have used and this seems to give me what I need for now. I redirect to my new “Session” and add the ID of the parent “Project” to the URL (EG: ?parent=67) and use GET to pass this to the update_field function.


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

You must be logged in to reply to this topic.