Skip to content
ProfilePress
  • Features
  • Addons
  • Pricing
  • Support
    • Contact Us
    • Documentation
    • Blog
  • Account
  • Buy Now
ProfilePress
  • Features
  • Addons
  • Pricing
  • Support
    • Contact Us
    • Documentation
    • Blog
  • Account

Home » ProfilePress Tutorials » WordPress User Redirection / Auto Login After Registration

WordPress User Redirection / Auto Login After Registration

Last Updated on March 25, 2024

Do you want to redirect new users to a custom page immediately after they sign up and auto-log them into your WordPress website?

In a previous post, we shared a code snippet that redirects users to a custom page immediately after they log in to their account on your WordPress-powered website.

Building on that, in this tutorial, I’ll share the ProfilePress guide and a code snippet that redirects users to a custom page upon completing their account registration.

This feature could be handy if you want to redirect users to a thank-you or congratulatory page after registration.

Setting Up Redirect & Auto Login After WordPress Registration

We will begin by purchasing and installing the ProfilePress plugin. To do this, Visit the ProfilePress pricing page and choose the pricing plan that best suits your needs.

After purchasing, download the plugin to your computer. Next, navigate to your WordPress admin dashboard, proceed to the Plugins page, and click the “Add New” button.

Then select “Upload Plugin” and click “Choose file” to locate the previously downloaded plugin zip file. Finally, click “Install Now” to complete the installation process.

After activating and configuring the plugin on your website, proceed to enable auto-login and set up redirection for users after registration.

To auto-login users after registration, navigate to ProfilePress settings, access the Registration section, and then check the Auto-login after registration checkbox setting.

After doing this, users will automatically be logged in after registration and redirected to their WordPress dashboard by default.

To redirect them to a custom page or URL after the automatic login, go to Settings >> Redirection and set up the Login redirect.

Note: The URL entered into the custom URL field takes precedence over a selected page.

User Redirection & Auto-Login After Registration Via Shortcode

You can automatically log in users to their accounts and then redirect them to a custom page using the redirect attribute in ProfilePress registration shortcode.

For example, a registration page with the shortcode[profilepress-registration id="1" redirect="https://xyz.com/welcome"] will log users in and then redirect them to https://xyz.com/welcome after they successfully register an account.

If you don’t want users to be logged in before the redirect happens, change “redirect” to “no-login-redirect” like so [profilepress-registration id="1" no-login-redirect="https://xyz.com/welcome"]

More info on the documentation page.

Setting Up User Redirection/ Auto Login After Registration Using Code

Note that the codes shared below only work if the user registration is done in a custom front-end registration form. The codes should go into your theme’s functions.php file or your site-specific / dummy plugin.

The code below redirects users to say a thank you or welcome page after registration.

add_action( 'ppress_after_registration', 'pp_redirect_after_registration' );

function pp_redirect_after_registration() {

	$custom_page_url = 'https://xyz.com/thank-you/';

	wp_redirect( $custom_page_url );
	exit;
}

What if we want to redirect them based on the role they are assigned during registration? See the code below.


add_action( 'ppress_after_registration', 'pp_redirect_after_registration', 10, 3 );

function pp_redirect_after_registration( $form_id, $user_data, $user_id ) {

	$a = get_user_by( 'id', $user_id );
	//retrieve the user roles
	$user_roles = $a->roles;

	/**
	 * we'll redirect users with student role to https://xyz.com/welcome-student/
	 * and those with teacher role to https://xyz.com/welcome-teacher/
	 * and those with other roles to https://xyz.com/welcome/
	 */
	if ( in_array( 'student', $user_roles ) ) {
		$redirect = 'https://xyz.com/welcome-student/';
	}
	elseif ( in_array( 'teacher', $user_roles ) ) {
		$redirect = 'https://xyz.com/welcome-teacher/';
	}
	else {
		// all other users
		$redirect = 'https://xyz.com/welcome/';
	}

	wp_redirect( $redirect );
	exit;
}

It is also worth noting that automatic login and redirection of users after registration can be done via ProfilePress’ ppress_after_registration action hook like so:

add_action( 'ppress_after_registration', 'pp_redirect_after_registration', 10, 3 );

function pp_redirect_after_registration( $form_id, $user_data, $user_id ) {

	wp_set_auth_cookie( $user_id );
	wp_set_current_user( $user_id );

	$custom_page_url = 'https://xyz.com/welcome/';

	wp_redirect( $custom_page_url );
	exit;
}

 

Set Up Your Auto-Login & Redirection After WordPress Registration Today!

In conclusion, customizing your WordPress registration flow by redirecting new users to a custom page upon sign-up while automatically logging them into your website can significantly enhance user experience and engagement.

With the guidance provided in this tutorial, you can implement these features using the ProfilePress plugin and/or code snippets.

Remember, a well-designed registration flow is the foundation of a successful website, and it can make all the difference in attracting and retaining users. So, take the time to set up auto-login and redirection after registration for your WordPress website today, and see the difference it can make in your user engagement and conversions.

If you have any pre-sale questions, inquiries, or contributions, get in touch.

Related

How to Redirect Users After Login in WooCommerce 

How to Redirect WordPress Users After Login - Complete Guide

How to Create a Custom WordPress Login URL

Create Paid Membership Websites in Minutes

Install ProfilePress today and get a modern and powerful WordPress membership & ecommerce website – the easy way!

Get ProfilePress Membership Plugin
Newsletter Subscription
Helpful articles and promos. Unsubscribe any time.

Subscribe to our email list now!

We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Thanks for subscribing!

Featured Tutorial

  • WordPress User Profile Shortcodes
  • Add reCAPTCHA to Protect WordPress Registration & Login Forms
  • Adding Register, Login, Logout Links to WordPress Menu
  • WordPress Login Form Shortcodes
  • How to Create a WordPress Frontend Edit Profile Page
  • Creating a Custom Student Registration Form for Tutor LMS
  • How to Create a Frontend WordPress User Profile Page
  • Adding WordPress Content Protection Rules to Restrict Content

Links

Login
Blog
Pricing
Addons
Try Live Demo
Request Support
Affiliate Program
Changelog
Documentation
Partners

Top Features

Create Membership Sites
WooCommerce Memberships
Sell Digital Product
Custom Registration & Login
Member Directory
Content Protection
User Moderation
Social Login
Metered Paywall
Invite Codes

Our Brands

MailOptin
FuseWP
CrawlWP
FeedbackWP

ProfilePress Exclusive

Education Blogging Ideas!

Receive top education news, lesson ideas, teaching tips and more!

Invalid email address
We promise not to spam you. You can unsubscribe at any time.
Thanks for subscribing!
Youtube
Copyright © 2025 Proper Fraction LLC.
ProfilePress™ is a trademark of Proper Fraction LLC.
Terms & Conditions · Privacy Policy
X icon to X close optin popup
Download ProfilePress Plugin

Enter your email and submit to receive a link to download the WordPress plugin.

We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Please check your email for the plugin download link.