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
- Can a user submit requests to wp-admin/admin.php without logging in?
- Wildcard multisite wp-admin url wrongfully redirected
- Disable directory browsing of uploads folder
- Trying to get custom js files in my admin header
- Can content be recovered in this situation?
- Why am I locked out of the system?
- how to customize the default #adminmenu in wp-admin
- Disable the “remember me” to wp-admin
- How to Restrict Access to all wp-admin pages for subscriber users
- Why is WordPress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?
- wp-login not found – All usual solutions not working
- Is there a filter to edit html of user-edit.php
- How do I change the hover (focus) color of admin bar from frontend?
- wp_get_update_data() function running on every admin request
- Run two wordpress on the same domain
- Selectively Disabling PHP via .htaccess in Root Directory
- nothing comes up when i go to my website.com/wp-admin? Which files should I look for?
- WordPress multiple admin notices on post update/add
- Sub menu is not working properly
- Programmatically emulate viewing a post in wp-admin
- Do not load the site as soon as you enter the WordPress panel
- How to remove some author fields from the edit comment page in wp-admin?
- Can I manage the photos that are pulled from Instagram before they are uploaded?
- do_shortcode() within Admin Page
- Not able to access WP Admin, it says “Sorry, you are not allowed to access this page.”
- How do I edit an add in wp_list_table and return to same page
- How to log into WordPress via GET/POST
- Locked out of WordPress after changing to HTTPS – Google Cloud VM
- How to make Media Library use HTTPS?
- How to remove Google fonts from wp-admin (Roboto) added by core
- Trying to login to my site redirects me to the first page
- wp.media – drag&drop overlay stuck
- Admin Login Checks
- Why might this disable other functionality?
- Search plugin form on “Add Plugin” page not working
- Managing advertising code snippets
- Getting 404s in wp-admin after logged in
- admin_url() do not retrieve the correct url in an subdirectory install
- WordPress Admin panel issue
- Can’t toggle between Visual and Text or Screen Options
- Cannot Update wp DB – Get 500 Error
- plugin: ‘init’ hook, check if we’re not in admin
- PHP Fatal error: Uncaught Error: Cannot unset string offsets when trying to upload any file to media library