I'm trying to come up with a wordpress page template (acting as a landing page) that redirects a user to another page based on their role.
ex. user with role editor goes to landing page and is redirected to "/editors-page/" user with role subscriber goes to landing page and is redirected to "/subscribers-page/"

I've come across so many plugins and custom functions that talk about redirecting at login but I'm using multisite and there are some complications using any of those examples so I've landed on the above solution.

Any help would be wonderful! Thanks so much!


You can use current_user_can() to check the user roles. https://developer.wordpress.org/reference/functions/current_user_can/

To check if the user is editor or administrator:

<?php if( current_user_can('editor') || current_user_can('administrator') ) {  ?>
    // Stuff here for administrators or editors
<?php } ?>

Then to redirect you can use this:

header('Location: '.$newURL);
  • This worked, sir!. Thank you. – user3311868 Oct 2 '19 at 16:27
  • If this worked, please mark the answer with the checkmark or rate it up. – MistaPrime Oct 2 '19 at 16:42

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.