WordPress is an extensible CMS. You can extend the functionality of WordPress by installing plugins. However, installing too many plugins is not the best practice as it can slow down your website. If you have multiple users on your WordPress site, not allowing them to install a new plugin might is a good idea from preventing your website from having too many plugins. To stop your users from installing new plugins, you can simply disable the plugin install feature by editing the wp-config.php file.
In WordPress itself, there are five user roles:
Only users with an administrator role can install a new plugin — and theme — in WordPress. If you want none of users with an administrator role to be able to install a new plugin, you can edit the wp-config.php file by adding the following line.
You can place the code above right after the last line of the wp-config.php file content.
How to Edit the wp-config.php File
Editing the wp-config.php file requires access to WordPress files. Most hosting control panels, including cPanel, come with a file manager feature to allow you to access files of your WordPress site. You can edit the file right from the file manager or download it first and then re-upload it once you are done editing the file.
If you use cPanel, you can click the File Manager menu under the Files section. This will launch the file manager feature of cPanel.
Double-click the public_html folder to open the WordPress files of your website and find the wp-config.php file. Select the file and click the Edit button on the top bar.
Once you are done editing the file, simply click the Save Changes button on the top bar to apply the changes.
To re-enable the plugin install feature, you can simply remove the
define('DISALLOW_FILE_MODS', true); line from the wp-config.php file.
define('DISALLOW_FILE_MODS', true); line to wp-config.php file will also disable the theme install feature.