Support

Account

Home Forums General Issues Choose ACF relationship field at registration form Reply To: Choose ACF relationship field at registration form

  • After looking into this further, you are not going to be able to use acf_form(). This issue is that this is a user registration form. There is no value get_current_user_id() under this condition. Also, ACF will not know that a new user is being created and will not be able to get the correct user id to save the fields for.

    What you will have to do instead is create a select field that you populate on your own with the select values. Since this you are saving a value in some type of relationship field the values need to be the ID of the related post.

    Then you will need to create an action for the WP user_register hook. This will provide the user ID just created. Then using this ID you use update_field(), using the field key and the "user_{$user_id}" post ID.