0

How to change home page to another page after login for all user roles, not a specific one?

1
  • Do you mean redirect to another URL? Or do you mean show different things on the homepage to logged in users?
    – Tom J Nowell
    Oct 2, 2017 at 12:53

3 Answers 3

1

By adding this to your theme functions.php file:

function login_redirect( $redirect_to, $request, $user ){
  return home_url('/');
}
add_filter( 'login_redirect', 'login_redirect', 10, 3 );
0

You can use a plugin, like 'Redirect After Login' (https://wordpress.org/plugins/redirect-after-login/)

Or you can do it manually by adding this to your functions.php

function admin_new_page() {
  return '/new-page-url';
}
add_filter('login_redirect', 'admin_new_page');
0

There is a standard WordPress function that you can use for this

<?php // Check if user if logged in. If so, redirect to www.example.com if ( is_user_logged_in() ) { header("Location:http://www.example.com"); } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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