The method for disabling the WordPress Add Theme and Plugin feature in this article is done without adding any plugins. You will need to add custom code to your theme file, specifically in the functions.php
Prerequisites for Disabling the WordPress Add Theme and Plugin Feature
- A website using the WordPress CMS
- Have Admin Dashboard access (with permission to edit themes)
- Have FTP or File Manager access
- Using a Child Theme (optional)
- Additional Script
Who Is This Method For?
- WordPress Developer
- WordPress premium theme developer (not recommended to use this method)
- WordPress website development service providers
- WordPress experiment enthusiasts
- Managers or owners of WordPress websites with many users, or more than one user who has full access to the Dashboard page
How to Disable the WordPress Add Theme and Plugin Feature
When you disable the Add Theme and Plugin feature, the Theme and Plugin editor features will be automatically hidden. If you only want to disable the Theme and Plugin editor features, you can read the guide on this page: How to Disable the Latest WordPress Theme and Plugin Editor Features
1. Via the WordPress Dashboard
- Log in to your WordPress dashboard (yourdomain.com/wp-admin)
- Find the Appearance or Themes
- menu. Open the Theme File Editor sub-menu under the Appearance menu
- Find the functions.php
- file. Add the code below to the very last line of the functions.phpfile, then save the changes.
// Menonaktifkan Fitur Add Theme dan Plugin WordPress
add_action('admin_head', 'nasikin_no_add');
function nasikin_no_add(){
define( 'DISALLOW_FILE_MODS', true );?>
<?php };PHP2. Via cPanel File Manager or FTP
- Open your File Manageror FTP client.
- Find the WordPress installation folder.
- Inside the WordPress installation folder, open the wp-content/themes/<theme name>
- folder. Find the functions.phpfile, then edit the file.
- Add the following code to the very last line of the functions.phpfile, then save.
// Menonaktifkan Fitur Add Theme dan Plugin WordPress
add_action('admin_head', 'nasikin_no_add');
function nasikin_no_add(){
define( 'DISALLOW_FILE_MODS', true );?>
<?php };PHPHow to Re-enable the WordPress Add Theme and Plugin Feature
If you have previously used a file or plugin that caused the Add Plugin or Add Theme feature to disappear, you can use the following method:
1. Edit the Functions.php File
Actually, this method via functions.php was just an experiment I did that happened to work. Generally, most developers disable the Add Plugin or Add Theme feature via the wp-config.php
file. To restore the Add Theme and Add Plugin features in WordPress, you can delete the code used to disable those features, or change true to false, so the code becomes like this.
// Menonaktifkan Fitur Add Theme dan Plugin WordPress
add_action('admin_head', 'nasikin_no_add');
function nasikin_no_add(){
define( 'DISALLOW_FILE_MODS', false);?>
<?php };PHP2. Edit the wp-config.php File
Changes via wp-config.php are generally not recommended because when you make changes in wp-config, it is more difficult to fix them. This is different from editing the functions.php file in a theme, where you can change the theme or reinstall the theme if an error occurs.
To restore the add theme and plugin features via the wp-config.phpfile, you can search for this code inside your wp-config.php file.
define( 'DISALLOW_FILE_MODS', true);PHPOnce the code is found, you can delete it to restore the add plugin and theme features, or you can change it to look like this:
define( 'DISALLOW_FILE_MODS', false);PHP
COMMENTS
Loading...