Code to Disable Installation of New Plugins and Themes in WordPress

/* Disable Installation of New Themes and Plugins */
define('DISALLOW_FILE_MODS',true);

If you don’t want your clients to add new plugins and themes, and also you don’t allow them to mess up with the existing plugin and theme files, you will add the above code to your wp-config.php.

This code will completely disable any kind of modification to the theme and plugin files in WordPress.

Warning: Make sure you don’t have File Manager plugin preinstalled. If it is installed and active, your clients will be able to access files on your server.

If you have the line “define(‘DISALLOW_FILE_EDIT’,true);” in the config file, Permissions for the File Manager plugin will be suppressed. Users can only view the files and aren’t allowed to edit them.

There are cases where we don’t update/ maintain some of our WordPress sites regularly. It is better to disable File Editing for those sites.

Once you add this code, the ‘Theme File Editor‘ and ‘Plugin File Editor‘ will be vanished from the dashboard. If you are using any code snippets, if already added, they stay active. If you want to add new code snippets, you have to manually add from the Hosting Control Panel or FTP.