If you are working on Wordpress site, you will be facing the problem of spam comments. These comments contains tons of HTML codes which is basically links. You can prevent your wordpress blog from these comments by using these tricks. If someone uses the strong code, it will not bold the text etc. and want to prevent your site. So today I'll tell you about how to prevent your wordpress blog from spam comments and how to disable html in wordpress comments. So that you can prevent your blog from such issue.
1. Remove unnecessary meta tags from WordPress header
Most of the spammers target blogs and wordpress sites for spams. If you look at the HTML source code of your WordPress site, you will find a couple of meta tags in the header that aren’t really required. For instance, the version of WordPress software running on your server can be easily retrieved by looking at your source header.
<meta name="generator" content="WordPress 4.1" />
This information is a good hint to WordPress hackers who are looking to target blogs that are using the older and less secure versions of WordPress software. To completely remove the version number and other non-essential meta-data from your WordPress header, add this snippet to the functions.php file found in your WordPress themes folder.
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;
2. Prevent people from browsing your folders
Since you would not like anyone to browse your WordPress files and folders using the explorer view in web browsers, add the following line to your .htaccess file that exists in your WordPress installation directory.Options All -Indexes
Also make sure that there’s a blank index.php in the wp-content/themes and
wp-content/plugins folder of your WordPress directory.3. Disable HTML in WordPress comments
The comment box in WordPress allows commenters to use HTML tags and they can even add hyperlinks in their comment. The comments have rel=nofollow but if you would like to completely disallow HTML in WordPress comments, add this snippet to your functions.php file.add_filter( 'pre_comment_content', 'wp_specialchars' );
No comments:
Post a Comment