How to Prevent Users from Editing Theme Files from the WordPress Dashboard

Updated: January 10, 2021

Theme is a required component of the WordPress system, which has a vital role. In addition to controlling the appearance of your website, you can also add a new function to WordPress by editing the functions.php file belong to the theme you use. For this reason, — if you have a WordPress site with multiple administrator-level users –, it’s crucial enough to disable the Theme Editor to prevent them from editing the theme files, including the functions.php file.

In the default WordPress configuration, you can access the Theme Editor by going to Appearance -> Theme Editor on your WordPress dashboard. To disable Theme Editor on your WordPress site, you need to edit the wp-config.php file. In other words, you need to have access to your WordPress files. The wp-config.php file itself lies on the top directory of a WordPress installation (public_html in most cases).

To start editing the wp-config.php file, log in to your hosting panel, and open the file manager. Seek for the wp-config.php file and add the following line:

define('DISALLOW_FILE_EDIT', true);

You can add the line above right beneath the last line of the wp-config.php content. Here is the example of the placement.

Don’t forget to save the change after editing the file. Once the file is updated, you should see no Theme Editor on the WordPress dashboard.

PS

If you have never edited the wp-config.php file before and afraid of something bad is about to happen to your site, make sure to back up the file first before you start to edit.

This page may contain affiliate links, which help support utilizeWP.

Leave a Reply

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

Share This