You could make it a mu-plugin (‘Must Use’ plugin). Any PHP file you put into /wp-content/mu-plugins/ will automatically get included in WordPress. You can’t deactivate the plugin (unless you have ftp access to the server). If you go with a mu-plugin, make sure to put the functionality into a subdirectory and bootstrap it with a php file in the mu-plugins directory.
EDIT
After reading the comment, I think I understand the problem better. It sounds like you want to be able to lock people out of the admin altogether. That’s not so difficult. Try this:
function my_awesome_admin_lockout(){
if( is_admin() && !current_user_can( 'manage_options' ) ) {
wp_redirect( home_url() );
die();
}
}
add_action( 'init', 'my_awesome_admin_lockout' );
Basically, that locks everybody but admins out of the admin area.
Related Posts:
- Change Login URL Without Plugin
- Securing wp-admin folder – Purpose? Importance?
- How to change “wp-admin” to something else without search-replacing the core?
- Block access to wp-admin
- Should I add the IP of the server that hosts my sites to the list of authorized IPs in the wp-admin/.htaccess?
- How to Change The WordPress Login URL Without Plugin
- 404 redirect wp-login and wp-admin after changing login url [closed]
- Couple questions about .htaccess, login page, updates
- Can I rename the wp-admin folder?
- “Too many redirects” ONLY when trying to access wp-admin page
- Use a different domain for SSL
- What is the best method to close off the backend?
- .htaccess in wp-admin produces a redirect loop
- Share same domain for wp-admin but for different website
- Wrong canonical link on wp-admin pages
- Can I rename the wp-admin folder?
- WordPress in sub directory wp-admin problem
- .htaccess rewrite rule for removing .php extension with exception of wp login and wp-admin
- Can’t access admin dashboard with wp-admin without /index.php after it
- Why should I password protect WP-Admin?
- Call to undefined function insert_with_markers
- Cannot log into WordPress Dashboard after removing/adding .htaccess
- Change WP-Login or WP-Admin
- Which HTTP headers to use for subdomain embedding?
- CDN + WP Admin Query – .htaccess redirection
- From 403 error to 500 internal server error
- FORCE_SSL_ADMIN not working
- Cannot Access Admin Area After Migration
- Wrong wp-admin URL
- Limit access to wp_admin
- I want to disable login of admin (/wp-admin) with email and make it accessible only with username
- password reset link being sent as HTTP?
- How do I host WordPress on a hidden domain through a reverse proxy?
- Logout USER form backoffice after 30 minutes of inactivity [closed]
- Do I have to face security problems if I changing default role to Contributor
- Hide username discovery
- Efficient way to check local WordPress php files and Database for malicious code? [duplicate]
- Renaming wp-admin without hard-coding it. Is it really possible?
- Need help for WordPress User Session Management?
- How login is possible, if I deny login page via .htaccess with allow ip
- Developer/Designer asking for admin access
- Redirect an entire WordPress site on a subdomain, except wp-admin
- Blank page when viewing wp-admin
- Is WordPress secure enough for a multi-user article directory?
- wp-admin going directly to 404
- WordPress /wp-admin redirect to wrong port in docker
- wp-admin and wp-login.php not Accessible after Cloudflare
- Can I rename the wp-admin folder?
- CSRF attack to create USER
- Disabling WP-Admin Caching in htaccess
- Can I rename the wp-admin folder?
- Limit access to wp-admin but still be able to log in from different locations?
- SSL doesn’t deliver parts of WordPress Administration Module
- Why WordPress not logout after I have close my browser?
- Making WP Admin Folder accessable JUST under a different link
- How to protect wp-admin from third party access?
- is exposed wp-admin site a serious security vulnerability
- How to display a static HTML page while setting up a WordPress site?
- How can I uninstall a language?
- Best way to present options for home page in admin?
- Delete Post From front Page ( With Wp-admin restriction )
- Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]
- Add mass action to wp-admin/users.php
- Add button in TinyMCE editor to insert text
- Can initial focus be set to search field in WordPress Media Library?
- When attempting to update a self-hosted WordPress site, I’m seeing “ASN1 unknown message digest algorithm”
- How to create a wp admin page (for use in an ajax request)
- Removing user fields [duplicate]
- Creating WordPress Admin Themes
- Add “Page Revised” column to Admin
- Redirect users away from Admin breaks ajax
- Form validation in WordPress Admin Panel
- XDG-OPEN is not recognized by WP CLI admin command
- How To Reset Ownership And Permissions of Wp-Content Folder, In Order to Fix HTTP Error When Uploading Images to WordPress Media Library
- Post Bulk Update
- sort tags by tag ID in admin panel
- How to fix ‘WordPress redirection loop problem in wp-login.php page’?
- wp-admin remove part of the url
- WP admin user search doesn’t return all users
- Where are screen options when in admin on mobile?
- post-new.php?post_type=product is not loading properly
- How to use underscore.js in WordPress Admin
- meta box on new admin page
- Site Crashes When Updating to WordPress (Version 3.6)
- How can I control which plugins run in the dashboard?
- WordPress admin section appears broken
- How to create directory under my active theme directory
- CPU overload spam – redirect link to wp-admin and new post
- define two login page url
- On Users (user.php) in wp-admin disable/hide “Bulk Actions” and “Change Role To”
- How can I can I make changes to a WP project I pulled from GItHub?
- WordPress critical error on wp-admin page with 100% permissions
- Add item to admin panel – w/o plugin & theme
- Show only childs and grandchilds of certain post in admin
- Is it possible to change the images source that are shown in the admin side?
- Using query string on edit CPT page
- $current_screen if condition for a specific page in admin
- All of my WordPress sites have Bold Open Sans
- How can you change the admin dashboard URL without symlinking?
- Degraded WordPress admin dashboard performance [closed]