How to Display Comments and Trackbacks Separately in WordPress?

trackbacks and comments for wordpress

WordPress was the first web based application to come up with a completely brighter and better form of the existing readers’ commenting system. Moving forward, we have seen some vivid changes with the way comments are being handled today.

Previously, you learned how to highlight the authors comments in the comment threads. Most of your readers expect to see the author’s comments as a response to different queries from the visitors.  But most of the bloggers who use WordPress are not aware of the widespread comment hack of separating trackbacks from comments. This separation is necessary so that you can help your readers focus on the proper stuff.

trackbacks and comments for wordpress

Following steps will guide you through the process of display comments and trackbacks separately in WordPress.

The first step is to clean up your trackbacks just by displaying the title. Don’t display an extract or a selection out of the title. Now to start with this, you will first need to check out the code shown below in the comments.php file of your active theme.

<?php wp_list_comments('type=pings'); ?>

Now, once you have searched successfully the above mentioned code, you will have to replace this with the code below:

<?php wp_list_comments('type=pings&callback=list_pings'); ?>

Lastly, you will need to insert the following code below your functions.php file of your presently active WordPress theme. This code is also optimized for your WordPress blog’s performance.

  function list_pings($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment;?>
    <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?>
<?php } ?>

Once you are done with the above two steps, you will be able to spruce up the trackbacks and the same changes will also be applicable if you have been using plugins to show your tweet backs.

trackbacks and comments

The additional work you would want to do is to repair the comment count so that it only displays real comments, refining out the trackbacks which are by default involved in the comment count.

For this you just have to add the code shown below in the functions.php file of your currently active theme.

  add_filter('get_comments_number', 'comment_count', 0);
  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;

This is the best method of separating trackbacks from comments and therefore conveniently carried out for even WordPress beginners. Make sure you follow each and every step carefully, without any error. If you miss, the process will fail. So take your time and do it slowly.

Learn more WordPress tricks here. It will only help you gain more control over your WordPress blog.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top