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
- Administrator user cannot access dashboard after localwp import
- What are the standard admin CSS id/class tags?
- Admin Ajax is returning 0
- Add custom column to Users admin panel
- Allow member to have access to custom post type only. Permission to only edit their own posts
- wp_verify_nonce vs check_admin_referer
- Add a Separator to the Admin Menu?
- How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?
- how to know if admin is in edit page or post [duplicate]
- Modal window from within WordPress admin
- Where in WP can I check history or log of updates of plugins etc?
- Adding a custom admin page
- How does admin-ajax.php work?
- How to check if user is in back end?
- Remove update nags for non-admins [duplicate]
- Give Editor Access To Sidebar
- How to remove entire admin menu?
- How can I speed up my WP admin section?
- How to pass parameters to admin_notices?
- Admin: very slow edit page caused by core meta query
- if admin is logged in
- Search posts by ID in admin
- How to Change the Default Home Page for the WordPress Dashboard?
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Find out which moderator approved comment?
- How To Remove WordPress Version From The Admin Footer
- Sort pages in loop by admin’s page attributes order field?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Hide other users’ posts in admin panel
- Set Default Admin Colour For All Users
- Editor Styles and Typekit
- WordPress admin stylesheet
- This CSS Stuffing Works, But Is This A Good Practice?
- Is it possible to create a WordPress tour? V3.3.1
- Securing Admin Accounts – Username Discovery
- is_admin() returns true when using admin-ajax.php from front end script
- wp_update_user not updating
- How to save dismissable notice state in WP 4.2?
- How do I optimize a custom post type admin page with 25,000 posts?
- Settings API – adding setting fields dynamically?
- Disable Media Uploads to non Admin Users