I am building a form on the front end that allows the user to add a new user by filling out the name, email, and password fields and hitting submit.

I understand that I can use wp_insert_user() with the appropriate user data, but how do I get this function to run when the form is submitted?

I tried calling a function from functions.php onsubmit, but it wasn't working. What is the best way to do this?

1 Answer 1


I think you're looking for a function but might also want to look at Gravity Form's solution for this: https://www.gravityforms.com/add-ons/user-registration/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.