Create template file that redirects based on user role
-
Hello,
I currently have a template file that redirects users to separate pages based on whether or not they’re logged in. It is shown below. This is so I can show different versions of the home page to registered and non registered users. I need to create (or modify) a template file to redirect based on user role.
For example, susbscribers who visit redirectpage are redirected to page-a, and editors are redirected to page-b. Is this possible?
Thank you!
<?php ob_start();?> /* Template Name: redirecT Courses */ ?> <?php get_header(); ?> <?php if (is_user_logged_in()) { wp_redirect('courses-3'); } else { wp_redirect('courses'); } ?> <?php get_sidebar(); ?> <?php get_footer(); ?> ob_end_flush();>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Create template file that redirects based on user role’ is closed to new replies.