I usually dont use plugins for this due to the fact its unstable.
I use this in my theme functions.php so you can always remove it if need be and it saves nothing to the DB.
This also leave open the admin ajax files if you need them for any theme functions like thickbox and a few others.
function erichamby_restrict_admin() {
if ( ! current_user_can('administrator') && $_SERVER['PHP_SELF'] != '/wp-admin/admin-ajax.php' ) {
wp_redirect( home_url() );
}
}
add_action( 'admin_init', 'erichamby_restrict_admin', 1 );
Related Posts:
- Get a list of all registered actions
- How can I force a file download in the WordPress backend?
- How to implement a customizable free OpenID authentication?
- How can I use WordPress functions in my stylesheet?
- What’s a reliable way to depend on another plugin?
- Woocommerce get cart total price in a number format [closed]
- How can I call a function from one plugin within another plugin?
- How to tell if Jetpack’s Photon is active?
- How can I modify the Capability needed to access a plugin’s options?
- Open Source plugin and requires licence
- How to delete the Hello Dolly plugin automatically?
- Where the Nickname is being used in WordPress
- Should a SEO plugin be necessary? [closed]
- Woocommerce – Hide “add to cart” on free products
- Fatal error: Call to undefined function wp_get_current_user()
- How can I mass-update/save all WordPress posts and pages?
- Create plugin with 3rd party MIT license code
- Is it good practice to remove redundant plugins and themes?
- What is the purpose of the “Hello Dolly” plugin?
- Delete option doesn’t appear for plugins
- How to check plugins for malicious code?
- Add image to post from external URL
- User profiles and object associations
- Generate Advanced Custom Fields box in custom admin menu page
- How can I include a setting that has a variable number of values in a settings page using register_setting?
- Share buttons on article footer
- How to use WP-FirePHP extension?
- WP plugin updates
- How to create a Page alias in WordPress
- change plugin shortcode function [closed]
- How to prepend to the_title for admin-side plugin’s use
- How can I retrieve data within my widget
- woocomerce variations [closed]
- Remove from Google Tags with less than 2 posts
- Custom data-id wp_enqueue_script
- Whats the difference between Page Builder Plugins and Theme Builder Softwares? [closed]
- How to use load_plugin_textdomain from within a theme
- woocommerce product attributes
- Settings API – input always updates over validation
- Creating search filter through plugin
- Yoast SEO blocking/re-initialising longer running process
- How can I rewrite a plugin generated URL?
- Add Fields with Sub-Fields to WP Job Manager
- Should I host support forum on wordpress.org or my own website?
- How to setup a Network Plugin across the network with only my settings?
- template_redirect not being called when using ajax
- WordPress language switcher
- jQuery Plugin to use WordPress functions in AJAX request
- Restore a Plugin’s Default Settings
- Mass Import Users without sending new user notification
- WordPress login with Phone Number [closed]
- Can a plugin deactivate itself?
- Syntax Highlighting Plugins and 3.2.1
- Problem Building a Simple Google Maps Plugin
- Is there a way to alter the order in which the plugins appear in the page?
- How to correctly detect accessing wp-content/uploads?
- “Members only” section of a WordPress site – self signup and no backend access
- Getting RGBA colour from gutenberg colourpicker
- Display content from custom post type if match to main post category
- woocommerce_order_status_completed action hook not working [closed]
- How to update billing_email when user_email is updated [closed]
- Plugin Using get_the_content Causing Issues With Tag
- Gallery plugin forces itself above text
- How to generate CSS from a shortcode within a plugin
- Using jquery migrate for plugins incompatible with jquery 1.10.2
- Disable multisite-wide plugins on specific sites
- How to embed HTML code from WP Coder plugin (or other) into Main Index Template of the theme
- Which escape function to use when escaping an email or plain text?
- Multisite custom user activation emails – html
- WordPress category add image field
- WordPress plugin – Error “Plugin generate 2890 characters of unexpected output when activated”
- Wp List Table – wpdb results are not displaying
- Change plugin main file name (that is currently in the repo)
- What is the correct way to update both WP/plugins/themes without breaking the site?
- Override global query results without hooks
- Adding widgets to header and footer from plugin
- SEO smart plugin not working for words ending with ä, ö, å
- resetting permalinks after changing page names
- Edit Yoast SEO breadcrumbs output [closed]
- How to read individual user’s directory and display content to that specific user?
- Adding a slider captcha to the comment system
- Rotating background images with admin options
- Woocommerce Payments and App Not Syncing
- Query all customers/users and check for duplicate information
- WordPress function not being called from jQuery method
- WordPress WPforms customization
- Admin accounts unable to see plugins from external IP
- WP ALL Import plugin – import data from certain ids
- Hide Elementor Templates Menu from Admin [closed]
- How to remove plugin metaboxes from edit.php
- WordPress wp-admin/network/plugin-install
- How to pull email and name from Flamingo plugin
- how to access all user dashboard on fronted page [closed]
- Display Swift Snippets in WordPress
- creating a custom shop page display on archive woocommerce
- Can’t delete the two native plugins of WordPress
- Configuring Propel to Work with Multisite
- Add custom JavaScript that is a combination of CDN/uploaded files and easily-edited code?
- Wysiwyg editor errors
- How I can internationalize variables within the function _e () __ (), etc?