I have a customize admin login. I want the admin to add user and redirect to a customize page upon successful add. Is there any webhook I can use?
You can use
user_register
hook for this; it is called after any user is register or added to DB.
Here is the code:
add_action('user_register', 'wh_redirectAfterRegistration', 10, 1);
function wh_redirectAfterRegistration($user_id)
{
if (empty($user_id))
return;
$user = wp_get_current_user();
$curr_roles = $user->roles;
$page_id = 70; //<-- Replace with YOUR PAGE ID
//if logged in user is admin
if (in_array('administrator', $curr_roles))
{
wp_redirect(get_permalink($page_id));
exit();
}
}
Code goes in function.php file of your active child theme (or theme). Or also in any plugin php files.
Code is tested and works.
Hope this helps!