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
- Logout redirect to home page
- Check IF is a “single product page” and Check the “role” for a Redirect
- Redirect page URL to home URL without using a plugin
- check first time login only
- How to change the default logout link on WordPress Admin
- How to setup 301 redirects for multiple query string URLs?
- WP auto redirects after url change?
- Setting a redirect cookie in wordpress
- Redirect users after first login
- Redirect to current page after wordpress login
- How does WordPress redirect to WooCommerce shop page? [closed]
- 301 Redirect Custom URL hierarchy to WordPress Posts
- Plugin Redirect After Activation
- $_SESSION variables lost during OAuth callback
- 404 redirection and Google’s index [closed]
- WWW to non WWW redirect effects on load speed
- Wp Login redirect strips parameters from url
- How to redirect user to specific page based on the input password
- Strange redirection issues on wordpress from ssl with padlock to ssl without padlock
- Change gravity forms confirmation redirect query string to include entry id [closed]
- How to redirect visitor to a custom URL using PHP code in functions.php
- Redirect home to another page with htaccess
- How do I redirect /search/ to ?s=
- 301 Redirect Loop
- Infinite loop behind SSL proxy on non-standard port
- Redirect from home page to post list page?
- set up 301 redirect within wp-content/uploads/ directory of a WP site to a new image URL
- How to redirect user after login to a specific page?
- .htaccess rule to redirect old URLs to new structure [closed]
- .htaccess Redirect
- Redirect when accessing /login when logged in
- Redirections and rewrites to subdomain
- Redirect user to previous page after signup from custom form
- How To Fix 404 errors caused by Google Indexing WordPress In Subdirectory
- Unable to access folders in same level as wordpress installation
- Get query parameters from external url and make a redirection
- Why does specifying ‘about-us’ as a link target take longer than specifying ‘about-us/’?
- Internal Links that Automatically Update
- Usage of the login_redirect filter
- Show different page for first time user
- Login/Register redirect user with message
- Redirecting to new URL structure and 301
- Blog has an infinite redirect loop
- WP forwarding to wrong site address
- wp_login_form redirect problem
- Redirect from ip to domain
- How does WordPress format the url on a 301 when a trailing slash is missing?
- Redirect only Blog posts to new
- Can’t make redirect in WordPress
- Unwanted slug in my website
- HTTPS to HTTP rewrite rules not working as expected
- Preventing Canonical Redirect for CDN
- htaccess 301 Redirect not working from aspx to new WP permalink
- Redirect posts to new domain
- 302 Redirect is showing in the audit but links are opening separately
- Add base folder to CPT and 301
- How do I redirect the browser to 404 page, if no posts are found in home page
- Redirect after the registration
- Conditional Login Redirect
- wp_logout_url redirect not working
- How do i make WordPress return 404 instead of redirecting on misspelled page?
- how to redirect non logged users to login page and redirect to another page with saved data?
- How to redirect if 404 error in wordpress then redirect 404.php url
- WP Redirect with Wild Card Characters
- How to automatically redirect category pages (301) when changing the location of a category in the hierarchy
- Unexpected: WordPress redirects to the WP_HOME/WP_SITEURL value
- Automatically switch language based on visitor’s country
- Do redirect 301 for wordpress page
- How to redirect user to Referrer Page using wp_signon in Custom Login Page in WordPress
- custom error message or redirect to custom page if any error occurs
- redirect after account activation for forum using bbpress and buddypress
- redirect_to ignoring the SSL
- One set of Child Pages redirecting to Home page?
- Redirect wordpress website URL into other link
- Redirect old .html URLs to a new installation in a subfolder
- Serve wordpress regardless of the cname
- Pass original URL through after login redirect
- redirects for removed/deleted woocommerce products
- Headers already sent error after upgrading wordpress to 4.2.2
- How to block direct access to files upload in edd folder
- Blog posts redirecting to random 404 pages
- Subpages return 404 server error
- WordPress 302 Redirect to Holding Page
- Converted posts to a CPT, 301 redirects necessary?
- Accept (once only) policy page on login
- Rewrite rule to redirect to a particular filename.php
- Redirect to other page when mobile
- Why my htacess rewrite return 404?
- woocommerce shop page Redirect Help
- Create a 301 Redirect automatically when adding %category% in the permalink
- Redirect user based on role when they try access a particular page
- How to redirect non-logged in users to wordpress login page and bypass some page IDs?
- How can I redirect the user to the page they were on when they clicked “Lost Password” using “retrieve_password_message” filter