WordPress: How to Separate Pingbacks From Comments

With the popularity of social networking sites, such as Twitter and Facebook, there has been an increase of pingbacks and external comments. Therefore, some bloggers find it easier to separate the two, so it’s easier for their readers and themselves to distinguish between the two. This can be done in two ways: Using a WordPress plugin or manually changing your blog’s code.

What are pingbacks and trackbacks?

Pingbacks and trackbacks are very similar, but other than using different communication technologies (Pingbacks use XML-RPC; Trackbacks use HTTP POST), there are only minor differences. Pingbacks are a way of keeping track of other blogs who have linked to your blog posts within their own blog posts. In order to do this, external blogs have to use your blog post’s hyperlink. Trackbacks work the same, except the blog post’s hyperlink is not placed within an external blog post. They are usually placed in an area specified for trackbacks. Additionally, pingbacks automatically will find the URLs; while trackbacks are done manually.

What are comments?

Comments are responses to a particular blog post that readers have written. Usually, comments are located right after the blog post. People have the ability to reply to one another’s comments directly on the blog without having to go to an external site.

Separating Comments and Pingbacks

If you have noticed, the MakeTechEasier comment system has separated out the pingbacks and the comments for better readability.


So how did we do it?

WordPress Plugins

There are three WordPress plugins that you can use to separate comments from pingbacks/trackbacks:

1. BM-TrackPing

What this plugin does is to strip out the trackbacks from the comment list and then add a single new comment with all the trackbacks in a list at the end. This plugin has not been updated for more than a year, so there is no guarantee that it will work well for the latest version of WordPress.

2. Separate Comments & Pings

This plugin removes pings and trackbacks from comment pages and place them in a new variable $pings. You will have to do further coding to insert the pingbacks separately.

3. Trackping Separator

Remove your pingbacks from the comments and provided you functions (to use in your theme) to list pingbacks/trackbacks separately.

Manually Changing the Code

By far, this is the best (and most effective) way to separate pingbacks/trackbacks from comments. You might get your hands dirty, but I assure you it will be easy. Just follow the instructions below:

Note: The following instructions assume that you are using WP2.7 and above. It will not work for any WP version less than 2.7

In your WordPress theme folder, download the comments.php file from the server.

Open it with a text-editor

Find the following code:

<ol class="commentlist">
    <?php wp_list_comments(); ?>

Change the code to be as follows:

<ol class="commentlist">
    <?php wp_list_comments('type=comment'); ?>
<ol class="commentlist">
    <?php wp_list_comments('type=pings&callback=list_pings'); ?>

What the above code does it to first display all the comments in an ordered list, followed by all the pingbacks/trackbacks in a second ordered list. You can play around with the code to style it up or to change the order of the display.

Once you are done editing, save it.

Rename the comments.php file in the server to comments-old.php and upload this newly edited comments.php to your server theme folder. Now go to your site and see the magic happens.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox