comment Author URL is bigger in WordPress

Spam comments are most irritating for bloggers. Reading the all comments and their content and desire. If Comment author URL is bigger then you should consider that comment as Spam comment for sure. Many times I observed, spammer always try to add their site URL in Author URL.

comment Author URL is bigger in WordPress

Using following code you can protect your site from spam commenters. Open your functions.php file from your theme folder and just copy/paste the following code into that.

Following code will automatically mark the comments as spam where author URL is longer than 60 chars.

function wpapi_bigger_url_spamcheck( $approved , $commentdata ) {
return ( strlen( $commentdata['comment_author_url'] ) > 60 ) ? 'spam' : $approved;
}

add_filter( 'pre_comment_approved', 'wpapi_bigger_url_spamcheck', 99, 2 );

Above code is very important for wordpress bloggers. Every wordpress blogger should add the above code into their site.

Spam comments If comment Author URL is bigger in WordPress
Spam comments If comment Author URL is bigger in WordPress

disable html code in comments wordpress

WordPress tutorial for, disable html code in comments wordpress. We given code sample for functions file to prevent html code in wordpress comments section.

If you are wordpress developer then only use following code. Open your functions.php file from your theme and put following code in that file. Just copy and paste the following code on your functions.php file:

disable html code in comments wordpress

function wordpress_comment_post( $incoming_comment ) {
	$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
	$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );
	return( $incoming_comment );
}

function wordpress_comment_display( $comment_to_display ) {
	$comment_to_display = str_replace( ''', "'", $comment_to_display );
	return $comment_to_display;
}
add_filter( 'preprocess_comment', 'wordpress_comment_post', '', 1);
add_filter( 'comment_text', 'wordpress_comment_display', '', 1);
add_filter( 'comment_text_rss', 'wordpress_comment_display', '', 1);
add_filter( 'comment_excerpt', 'wordpress_comment_display', '', 1);
disable html code in comments wordpress
disable html code in comments wordpress