How to Disable Theme and Plugin Editor from WordPress Admin Panel

WordPress comes bundled with a code editor which allows you to edit your theme and plugin files from your Dashboard. To access theme editor you need to navigate to Appearance > Editor and to access plugin editor you need to navigate to Plugins > Editor.

Although this feature comes in handy, it can lead to serious issues like source code modifications by someone with the admin access who is not familiar to programming, leading to the website crash or malware installation by a malicious user who somehow managed to gain admin access.

You can easily avoid these issues by disabling the theme and plugin editor from the dashboard. All you need to do is open your wp-config.php file located inside your root directory. And drop the following code before the line that contains /* That’s all, stop editing! Happy blogging. */ comment.

define( 'DISALLOW_FILE_EDIT', true );

And that’s it! This will remove both theme and plugin editor from your WordPress dashboard.

Quick Tip: How to Remove URL / Website Field from WordPress Comment Form

How to Use Shortcodes in Your WordPress Sidebar Widgets

WordPress out of the box doesn’t allow you to add shortcodes to the Text widget within the sidebar. However, there is a easy workaround for this issue.

All you need to do is add the following code to your functions.php file.

add_filter('widget_text', 'do_shortcode');

The above code will parse the content of text widget and execute shortcodes before loading the widget.

Must Read: How to inject Document in Angular service