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

How to Remove URL Field From WordPress Comment Form

WordPress out of the box provides a website link in the comment section which allows the users to mention their website name while dropping a comment on your blog post.

Although its a quite handy feature, it is often targeted by spammers to generate a backlink to their website. Most of the times these spammers put comment and links which are not related to your blog or blog post.

A simple way to prevent these spam comments is to remove the website field from the comment form.

This can be achieved in two ways.

Option #1 Using a WordPress plugin.

If you’re not a Developer I’ll recommend you to use a plugin to disable website links.

Step 1. Install Comment Link Remove and Comment Tools plugin
Step 2. Navigate to “QC CLR Settings” from the sidebar menu.
Step 3. Under “General Settings” check “Remove WEBSITE Field from Comment Form”
Step 4. Hit “Save Changes” button at the bottom of the page.

Option #2 By adding a hook to your functions.php file

To hide the website field from the comments form all you need to do is add the following code to you’re functions.php file.

// Remove comments form link
function hsl_remove_comment_form_link($fields) { 
  unset($fields['url']);
  return $fields;
}
add_filter('comment_form_default_fields','hsl_remove_comment_form_link');

That’s it! I hope you found this post useful. If you’ve any query or feedback feel free to drop a comment.

Must Read: JavaScript Console Tricks