Do you want to disable theme and plugin editors in WordPress? Our snippet not only disables theme and plugin editors, but it also disables the ability to delete plugins.
Instructions:
All you have to do is add this code to your wp-config.php file on your WordPress install.
define( 'DISALLOW_FILE_EDIT', true ); define( 'DISALLOW_FILE_MODS', true );
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 62 best free WordPress blog themes or 7 best WordPress contact form plugins.
if you leave define(‘DISALLOW_FILE_MODS’,false); too this will affect auto-update WordPress (since 3.7)
Do you know how to fix this problem:
I added:
define(‘DISALLOW_FILE_MODS’,true);
define( ‘DISALLOW_FILE_EDIT’, true );
to wp-config.php and then when I deleted it, the plugins did not come back.
I tried changing them to:
define(‘DISALLOW_FILE_MODS’,false);
define(‘DISALLOW_FILE_EDIT’,false);
but that did not work.
Any clues? Thanks.
This one is very useful for making sure customers don’t mess with plugins and editor setting. Thanks!