All functions place in functions.php of your theme. And create redirect on template_redirect hook.
add_action('template_redirect', 'make_redirect');
function make_redirect() {
if ( ! is_admin() && ! current_user_can( 'administrator' ) ) {
wp_redirect( 'https://google.com' );
}
}
Related Posts:
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Restrict dashboard access for specific user roles to specific actions
- Redirect admin 403 “Cheatin uh?” admin pages
- You do not have permission to access this document on form submit
- Different customer login form than administrator login form?
- How do I remove dashboard access from specific user roles?
- The website cannot display the page
- Can an admin check passwords of registered users?
- Prevent author from changing their posts if admin has modified
- How to remove administrator role in settings -> general -> New User Default Role?
- Create un-removeable user
- Custom CSS In Admin Only For Certain Roles
- Remove ability to access certain admin menus
- Remove admin AND editor from the “change role to” menu in user listing
- Customize the upload screen
- Blocking Administrative Access to Authors and Subcribers?
- Customize Admin Users Screen based on Role
- Make certain pages uneditable by editors?
- How to display only logged in user’s post comments in comments area
- Check if user is logged in else login page
- How can I restore admin capabilities?
- Protect custom php file with login
- What determines whether admin toolbar is shown to a logged-in user?
- front end editing using iFrames, best approach?
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- Displaying different in-page content to cliente/admin
- How to hide a specific part of dashboard for non-admin roles?
- WordPress administrator area access disabled temporarily due to widespread brute force attacks
- WordPress Remove Submenus
- Create a WordPress administrator without access to back-end
- Only Admin can Edit, Delete or Update
- add_cap for editor but no admin role
- Shared account / dual blogging in WordPress
- Bind custom role to admin page
- Admin login not working
- Access for adding subpages but not for pages
- remove menus for a specific role?
- Hide front-end from every logged out user and redirect them to the default login page
- Allow admins to login as other users
- current_user_can(‘administrator’) not working in custom login
- Show global Message in User Profiles with admin only Input field in WordPress Backend
- How to make sure your admin doesn’t hi-jack you site?
- Send admin to a different login than users?
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- How should I setup the “Users” area to hand over to a client?
- solution to prevent specific admins from altering site contents
- Admin user roles/permissions
- Posts in sidebar only by admin
- Custom user roles are unable to login
- How To Remove Import/Export Option From Tools?
- Doesn’t call user information to include “wp-load.php” in an external php file
- Hide top admin panel for non admin and non editors
- How can I create multiple different admin roles with their own capabilities
- Signed-in as admin on just part of the site
- How to change the title attribute for the WP logo image on wp-login.php
- Different role for free and pro users in wordpress without using bbpress
- WordPress login process is hanging
- Capability to read/edit page in wp-admin only for administrators
- Add custom column to Users admin panel
- Sort pages in loop by admin’s page attributes order field?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Plugin to remove Admin menu items based on user role?
- How to obtain the user ID of the current profile being edited in WP-Admin?
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Hide Admin Menu for Specific User ID who has administrator Role
- Get current active wp color scheme
- How to fix admin stylesheet muck-up? [closed]
- Turn off admin emails for new user registrations
- Adding custom Javascript to the head tag in Admin
- Replacing the List table of a Post Type
- Adding scripts to admin page in my theme
- How to notify the admin about something that happened during a cron job
- I’m receiving requests to change the admin email. How can this be happening?
- Set admin body to ltr on a rtl installation
- Are there any filters to add additional columns to the list table on edit-comments.php?
- Can I mass change all admin emails for a multisite instance?
- WordPress admin area used to administer other site
- How to create user specific pages (not user role!)?
- Add ‘Last Modified’ and Attachments (Yes/No) to WordPress Users Column
- Seems that admin_post_{action} does not executing
- How to log out from admin or front-end only?
- remove wp admin menu by customer user role
- WordPress Brute Force Prevention
- admin_enqueue_scripts not rending JS file correctly
- Accidentally changed website url
- Private post hidden from Admin too
- Having problem creating local instance of wordpress site
- WordPress Plugin Admin Tab
- Give users acces to admin a single post or set up WP network?
- if role is logged in then do something
- Gutenberg UI has changed
- Highlight active Admin Menu when added though add_menu_page
- When admin approves a registered user, I don’t want to send a notification email to users
- add instructions to upload pages and / or forms
- Populate Dropdwon with DIR files, save value and keep it “selected”
- Blank page beyond dashboard
- Cannot save Post
- each user having category with their name and can add sub categories post in that category
- I don’t have permission to save the theme options I created myself?