One of the most amazing features that WordPress offers is the ability to install themes and plugins and create a website in minutes. However, sometimes we may want to make changes to the theme or plugins by modifying the code and for this WordPress allows direct access to the themes and plugins’ files from the WordPress Dashboard to edit it as per needs. This feature is pretty handy but can be dangerous too if you are a beginner and may ruin the entire website if you don’t how to handle the code. So, let’s find out how to disable the theme editor and plugin editor in WordPress Admin Panel.
How to Disable Theme editor and Plugin editor in WordPress
WordPress allow users to edit the theme files and plugin files through the admin panel and this feature is enabled by default in all WordPress installations.
Many times users end up ruining the entire website by trying to edit the WordPress themes code or Plugin codes and for this reason you may want to disable this feature.
It is always a good idea to disable the theme editor and plugin editor in WordPress Admin panel to prevent your website from getting screwed up.
In this article, we will share with you a one line code that will disable theme and plugin editors functionality from WordPress.
So, let’s find out how to disable to the theme editor and plugin editor in WordPress with a single line of code.
- Access your wp-config.php file and open it. Instructions to locate your wp-config.php are in this post – How to Fix error establishing database connection in WordPress
- Open or choose the edit option to edit wp-config.php file and paste the following code anywhere in the file on a new line:
define( ‘DISALLOW_FILE_EDIT’, true );
Tip: wp-config.php file is located in the root folder of your WordPress install whether you access the hosting server through FTP or File manager in cPanel.
3. Save the file and upload back to the root folder through the file manager or FTP.
You are done with the changes and once you refresh the WordPress Admin dashboard you would notice that the theme editor and plugin editor functionality is disabled.