Stop WordPress from Sending Internal Trackbacks
If you’ve noticed that you receive self-trackbacks when linking to your own internal content on your WordPress blog, you probably feel that it’s pretty annoying. The main point of a trackback is to communicate with OTHER blogs, not your own. After all, why would you want to display a trackback to the post you’ve already linked to in the content?
To disable self trackbacks in WordPress, you have a couple options. You can disable them with code or by using relative URLs.
Disable Self Trackbacks with Relative URLs
Some developers argue that relative URLs are not a good idea while others don’t see them as a big deal. Personally, I don’t mind using them but that argument will be for another post. To prevent self trackbacks in your WordPress blog, you can use relative URLs. The difference between absolute and relative URLs is the base An absolute URL will begin with your domain name and relative URLs begin with a slash ( / ). For example, http://yourdomain.com/test-post is an absolute URL for yourdomain.com while /test-post is a relative URL. Relative URLs can only be for internal links and must follow the appropriate path structure (i.e. child pages and wp-content files).
Disable Self Trackbacks with Code
This code snippet is courtesy of Paul Underwood. It can be pasted into your theme’s functions.php or a custom plugin.
//* Disable Self Pingbacks add_action( 'pre_ping', 'disable_self_trackback' ); function disable_self_trackback( &$links ) { foreach ( $links as $l => $link ) if ( 0 === strpos( $link, get_option( 'home' ) ) ) unset($links[$l]); }
Leave a Reply