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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.