HOWTO: Escludere pingbacks e trackbacks in WordPress
Every time someone puts in a blog or an aggregator our article, we in return receive a linkback, which obviously can not make us happy, because in the eyes of our article Google acquires importance.
WordPress automatically inserts all linkbacks in the comment box, which is just past the post.
However these are not real “Comments”, and so it is not right that they are counted at the end of the post: “X There are no comments”, for a simple aesthetic fact (and even logical, add).
To do this, simply open the folder of your theme in / wp-content / themes, and open the file functions.php, and insert, immediately before “?>” which is located at the end of the file, the following code:
//funzione per contare solo il numero di commenti e non pingbacks
function comment_count( $COUNT ) {
if ( ! is_admin() ) {
global $ id;
$comments_by_type = &separate_comments(get_comments('status=approve&post_id = ' . $id));
return count($comments_by_type['comment']);
} else {
return $count;
}
}
add_filter('get_comments_number', 'comment_count', 0);
You do not have the functions.php file? no fear, createlo can, and enter the above code between the tags <? and ?>
NOW, when you open a post, trackbacks will not be counted in the comments (while continuing to appear!), and it will show the message “THERE ARE TESTED COMMENTS” until someone will not write a comment TRUE.
Soon I will write about how to separate comments and trackbacks in WordPress, so as to show first the one and then the other.