I often need to "do things" when new users are created in my Wordpress site. The only action hook that I know I can count on is user_register
.
The problem is that I think it is triggered relatively early in the process of user creation, so often there is user information that is not available or other plugins make changes after my functions are called.
I've researched but had no luck, what resources explain the way WordPress creates users and which hooks fire when?
Actions are one of the two types of Hooks. They provide a way for running a function at a specific point in the execution of WordPress Core, plugins, and themes. Callback functions for an Action do not return anything back to the calling Action hook. They are the counterpart to Filters.
In this case, the best documentation is the code itself.
The hook user_register
is fired in /wp-includes/user.php#L1418
and no other useful action seem to be available there.
We got user_profile_update_errors
in /wp-admin/includes/user.php
, but not sure of its usability here.
The function wp_new_user_notification()
called in the previous file is pluggable, meaning that you can override it and do your own stuff there. Maybe it's a good option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With