• Posted: 2011-07-18
  • Author: Filip Stefansson
  • Tags:

Disable self trackbacks

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
<?php
function disable_self_ping( &$links ) {
    foreach ( $links as $l => $link )
        if ( 0 === strpos( $link, get_option( 'home' ) ) )
            unset($links[$l]);
}
add_action( 'pre_ping', 'disable_self_ping' );
?>

Instructions:

WordPress trackback system makes sure that other blogs are noticed when you link to them. This is a great way to get more users, since a link to your post will be displayed on the target website.

Problem is, when you link to one of your own posts, on your own website, a trackback will be displayed although the link is coming from you.

To disable this, put the snippet in functions.php.


Related links:
http://codex.wordpress.org/Introduction_to_Blogging#Verifying_Pingbacks_and_Trackbacks
Share this snippet

If you like this snippet, share it with friends!