I have 2 different pages one is for employee and other one is for employer , After signup I need to redirect page based on user role:-

  • If user role is employee redirected to employee page


  • If user role is employer redirected to employer page,
  • 1
    The simplest way to do this is via a plugin. I use Peter's Login Redirect for this most of the time. It supports redirects based on user roles etc. – Monkey Puzzle Jun 2 '16 at 6:49
  • on that note theme my login is also good with this – majick Jun 2 '16 at 8:25

You can use register_new_user hook which is the last hook before WordPress perform the redirect to check your email page.

In the callback function you will get user ID, using it get the user data and check if user belongs to specific role.


function wpse_228545_register_redirect( $user_id ) {
    $user_data = get_userdata($user_id); //Get the user data
    $roles = !empty($user_data->roles) ? $user_data->roles : array();
    $page_slug = '';

    if ( in_array('employee', $roles) ){
        $page_slug = 'employee';
    } else if ( in_array('employer', $roles) ) {
        $page_slug = 'employer';

    if ( $page_slug ) {
        //You can use get_permalink() and get_page_by_path() 
        //if you have different URL structure Or want to change in future.
        wp_safe_redirect( site_url( $page_slug ) );

add_action('register_new_user', 'wpse_228545_register_redirect');
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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