How to Disable Theme and Plugin Editors from WordPress Admin Panel

How to Disable Theme and Plugin Editors from WordPress Admin Panel

This plain code editor allows you to edit your theme and plugin files directly from the WordPress dashboard.

Now, this may sound really helpful, but it can also lead to issues such as breaking your site and potential security issues when combined with other vulnerabilities.

Why Disable Theme and Plugin Editors in WordPress?

WordPress comes with a built-in code editor which allows you to edit WordPress theme and plugin files directly from the admin area.

The theme editor is located at Appearance » Theme Editor page. By default, it will show your currently active theme’s files.

Similarly, the plugin editor can be seen at Plugins » Plugin Editor page. By default, it will show you one of the installed plugins from your site that comes up first in the alphabetical order.

If you visit the theme or plugin editor page for the first time, It will warn you that using the editor can break your website.

In WordPress 4.9, theme and plugin editors were upgraded to protect users from accidentally breaking their website. In most cases, the editor will catch a fatal error and will revert back the changes.

However, this is not guaranteed and some code may still slip through and you would end up losing access to the WordPress admin area.

The biggest problem with the built-in file editor is that it gives full access to add any kind of code to your website.

If a hacker broke into your WordPress admin area, then they can use the built-in editor to gain access to all your WordPress data.

Hackers can also use it to distribute malware or launch DDOS attacks from your WordPress website.

How to Disable Theme and Plugin Editors in WordPress

Disabling theme and plugin editors in WordPress is quite easy.

Simply edit your wp-config.php file and paste the following code just before the line that says ‘That’s all, stop editing! Happy publishing’ :

define( ‘DISALLOW_FILE_EDIT’, true );

You can now save your changes and upload the file back to your website.

That’s all, plugin and theme editors will now disappear from themes and plugins menus in the WordPress admin area.

You can also add this line of code to your theme’s functions.php file, a site-specific plugin, or by using the code snippets plugin.

If you don’t want to edit the files directly, then you can install the Sucuri plugin which offers 1-click hardening feature.

Proper Way to Edit WordPress Theme and Plugin Files

Many users actually use theme and plugin editors to look up the code, add custom CSS, or editing code in their child themes.

If you only want to add custom CSS to your theme, then you can do so by using the theme customizer located under Appearance » Customize.

If you want to look up the code in a plugin, then you can do so by using an FTP client.

For better file management and syntax highlighting, you can use one of these code editors for editing files on your computer.

Last but not least, you can also create a custom WordPress theme without writing any code.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.