AI Verified
Redirect user role on specific page
This code will redirect a specific page based on the user role NOT being met.
PHP
Voted: 0 by 0 user(s)
Drop the snippet in to your functions file and change the 'page-slug' to the page slug you want to redirect roles from and change the 'role_type' to your desired role.Finally change "https://www.secretstates.com" to the URL you wish to redirect to. NOTE the 'administrator' is added so the administrator can still view the page.
Scroll down to see more snippets from this codevault.
The author has indicated that this snippet is compatable up to wordpress version: 6.1
Our AI bot has checked this snippet is compatable up to wordpress version: 6.1
Free & Pro
Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.
Pro Only (Coming Soon)
You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.
Last modified:
05/12/2022
This snippet has the following status:
AI Verified
This snippet has been tested by our AI bot, see any comments below.
AI Bot Comments:
Found 0 vulnerabilities
0
Please see some snippets below related to this snippet..
WordPress Admin
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
In $forbidden_message_strings array, provide a list of keywords or phrases that you want to disable. Provide a longer phrase to increase specificity
WordPress Admin
AI Verified
WordPress Admin
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
Based on work by platypus424 and germankiwi, this snippet will allow you to see code on a particular line number from all of your snippets, allowing you to track down exactly where an error might be o...
These are some popular snippets from this users codevault..
WordPress Admin
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
This code will redirect a specific page based on the user role NOT being met.
WordPress Admin
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
Wordpress function to redirect one page id to another page id
WooCommerce
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
Redirect a product category to a page ID
Category
Snippet Status