Home › Forums › ACF PRO › Append Fields to WooCommerce Register Form › Reply To: Append Fields to WooCommerce Register Form
You would put the class in your functions.php file. It will instantiate when the file is loaded and add the needed action and filter will be added to WP.
I use a class because we must get the new user ID with one filter and then use it in another filter. To do this you have 2 choices, create a class that can store values independently or use global variables, and I’m not a fan of global variables.
And as I said in my last post, I am not sure that it will work, it’s all just a guess.
If it does work, the method user_register() will run when a new user is registered, storing the new user id.
Then the method pre_save_post() will run before ACF saves the post and we set the correct user ID for that user so ACF stores the values in the right place.
This all hinges on the hook user_register
firing before acf/pre_save_post
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.