Redirect to a page after successful registration

Sometimes when building a site or theme with WP User Manager, you will want to redirect your WordPress users to a page notifying them that the registration was successful.

Achieving this is very easy, you will need to hook to the action called:

wpum/form/register/success

This action also passes 2 parameters that contain the user id of the newly registered user together with the content submitted into the registration form.

Accepted parameters:

  • $user_id: string - id number of the user.
  • $values: array - contains list of submitted values into the registration form.

Example usage:

function wpum_redirect_after_registration( $user_id, $values ) {

	wp_redirect( home_url( ) );
	exit;

}
add_action( 'wpum/form/register/success', 'wpum_redirect_after_registration', 10, 2 );

The above example uses the  wp_redirect() function to redirect users to the homepage - the url of the homepage is retrieved using the home_url() function. 

To redirect users to a specific page you can replace the home_url() function with  get_permalink( $page_id ).