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);
Related Posts:
- Redirect After Delete User in Backend
- How to target specific user role?
- Is it possible to incorporate username in a login redirect?
- Redirect each user to specific pages based on their role
- Redirect Page ID, based on logged-in User Role
- Conditional redirect on login using referring URL
- Redirecting by role from a button
- Disable front end to use as CMS only?
- How to prevent automatic redirection of 404 errors and “incorrect” URLs?
- Redirect Localhost wordpress site to dashboard
- Why is wp_redirect() preferable to a standard PHP header redirect?
- How to redirect a sucessful registration to a page template?
- How to redirect all requests to wp-login.php?
- Index in root, wordpress in subdirectory
- WordPress overriding actual subdirectories
- Redirect to “All Posts” after post update or publish in Block Editor
- Redirect user after login/registration globally
- Redirection errors
- How do I redirect upon login a specific user based on role?
- WordPress CMS – hide content from public while in editing stages
- Redirect to a page after a few seconds
- How to redirect only if page doesn’t exists
- how to do logout redirect to current url
- htaccess redirect – directory and subpages to a single page
- Plugin for conditional redirect
- url keeps redirecting to a page
- https multiple redirects
- Redirects from Tumblr to new WP
- Why does multisite bypass WordPress for wp-content, wp-admin, wp-includes and .php files?
- Redirect after users complete profile form
- Redirecting to old domain, tried everything, nothing works
- How to modify the Register link in the login page?
- WordPress redirecting to 127.0.0.1 when accessing the site from a remote device
- Changing “Lost Password Email Link” to custom password reset page
- Redirect a page id url but not the page slug
- Redirect based on parameter in url
- Stop wordpress redirecting www to non-www
- WordPress Global Redirect
- Why does wp_redirect strip out %0A (url encoded new line character) and how do I make it stop?
- htaccess redirect – replace special character
- Redirect Logged In User if page is wp-login.php and $_Get[‘level’] = X
- WordPress url incomplete redirects to first article with that name
- Right hook to redirect frontend visitors while respecting rest api plugins to run first?
- Redirect loop after changing nameserver [closed]
- Create a page that automatically redirects to latest post of a specific tag/category?
- How to make wordpress folder (/wordpress) redirect to /?
- Changing domain
- How to redirect on login to a specific page if a specific meta user is empty
- Redirecting amp url to non amp url
- How To Redirect /url.html to /url?
- Redirecting Pages That No Longer Exist — But Could in the Future
- How do I determine what is causing a redirect for a given page?
- Trouble running local WordPress in Google App Engine
- Empty folder being created by WordPress, breaks site
- How do I put up a splash page and have all WordPress links redirect to this page?
- How can I disable author pages without 301 redirects?
- Redirect specific URL before other redirects take place in .htaccess?
- Redirect Main Home Page url to category URL without plugin
- Stop forcing certain paths to end with a forward slash
- Force 404 redirect to home?
- Is it possible to wp_redirect() to a new tab?
- Dynamic 404 page content while still keeping 404 status code?
- Redirect user to specific link after login
- After retrive password, redirect to index page
- Change Category Slug Redirection
- WordPress redirect to new domain name
- Blog post is redirecting to home page
- Trying to re-direct users to specific page based on an ACF variable
- wp_redirect is only working in Chrome Network, page is not redirecting
- Bulk redirect all post
- Disable redirect to homepage after successful Login, Stay on Current Page
- WordPress no permission redirection to a popup
- How force WordPress redirect to current custom page after login
- How to remove redirection
- Site using static homepage, redirects (301) and removes pluses from query string
- Unusual Apache2 Error Causing WordPress Redirect Error?
- Redirect error after updating WordPress to 5.4.2
- 301 Redirect Loop www to non-www – Nginx + Apache2
- how to redirect 404 to attachment.php?
- 301 Redirect in WordPress not working in htaccess
- redirect to https://my-site/wp-admin/ instead of https://my-site/wordpress/wp-admin/ after options updating
- Redirect after login when WordPress in subdirectory
- I get “too many redirects” problem when migrating localhost site
- Redirect after Permalink change – What regex do I use?
- Configure WordPress to listen on a port other than 80
- Do I need to keep the original page when 301 redirecting to a new one?
- I’ve move my site but URL still goes to the old site
- Conditional redirection with logout
- Logging back into WordPress after logging out and having issues with ‘loggedout=true’ in redirect URL
- Moving an ASP Site to WordPress – Looking for Help on Redirects
- WordPress subfolders htaccess bypassing the root htaccess RewriteRule
- Rewrite Rule working different than expected
- When invalid child page entered, WP redirects to next available page instead of giving Page Not Found
- Redirect non-logged in users to a specific page
- Forward and mask implementation not working,
- Redirect from subdirectory to WordPress plain permalink
- Top-level staging-site URL redirects to a different site
- Show different page depending on user role
- Problem after redirect homepage to /en/
- Site1 wordpress website redirect to other site2 in my same server