Home WordPress How to Disable Theme Editor in WordPress

How to Disable Theme Editor in WordPress

In WordPress, you can edit the files of your theme without having to open the file manager on your server. Instead, you can edit a file of your theme right from the WordPress dashboard by opening Theme Editor (Appearance -> Theme Editor). This feature is pretty useful to make a minor change to your theme like changing the font size or changing the link color although you can also make a more advanced change. Only users with an administrator-level are able to open Theme Editor.

Since Theme Editor makes it possible to make any change to your theme, it can be a bit risky if you have a WordPress website that has several users with an administrator-level. Due to this, you might want to disable the Theme Editor in your WordPress site. You can disable the Theme Editor feature by modifying your WordPress configuration. To do so, open the wp-config.php file and add the following line. You can add the following line anywhere within the wp-config.php file. We recommend you add it to the last line (before the ?> tag) to make it easy for you to identify it later if you want to make other changes to your configuration.

define('DISALLOW_FILE_EDIT', true);

If you want to re-enable the Theme Editor feature, you can change the true value on the line above to false. You can add a little note before adding the line above to remind you what is the line about.

If you want to add more restrictions, you can also add the following line to the wp-config.php file.

define('DISALLOW_FILE_MODS', true);

The line above restricts all WordPress users with an administrator-level to make administrative actions such as installing a new theme, installing a new plugin, and upgrading WordPress to the newer version from the WordPress dashboard.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

MOST-READ THIS WEEK