How to disable internal pingbacks in WordPress

You have probably noticed that when you link to a post on the same site you will get a pingback on the old post with a link to your new post. If you for whatever reason wants to get rid of those internal pingbacks, simply put the following code snippet in your functions.php. Note that you will still get pingbacks from other sites.

function disable_internal_pingbacks( &$links ) {
	$home = get_option( 'home' );
	foreach ( $links as $l => $link )
		if ( 0 === strpos( $link, $home ) )
			unset($links[$l]);
}

add_action( 'pre_ping', 'disable_internal_pingbacks' );

If you don’t like writing or adding code to your functions.php, you can instead install the No Self Pings plugin from WordPress plugin directory.

About Fredrik Malmgren

Fredrik Malmgren is an entrepreneur, project manager and developer specialized in WordPress. Read more about me or get in contact with me. You can also find me on Twitter. (@fredrikmalmgren).
This entry was posted in Tutorials, WordPress and tagged , , , . Bookmark the permalink.

8 Responses to How to disable internal pingbacks in WordPress

  1. Pingback: Tweets that mention How to disable internal pingbacks in WordPress | Fredrik Malmgren -- Topsy.com

  2. Pingback: About Pingback disabling, great plugins for preventive measures and the “Superpuperdomain.com” Wordpress Hack | Blogger's Weekly

  3. Mark Gason says:

    Awesome handy piece of code thanks. That has been bugging me and finally bugged me enough to look for an answer.

  4. jyoti says:

    Why should we disable the internal pingbacks? dont you think so it will improve the page rank of the site?

    • Fredrik Malmgren says:

      I don’t know actually.
      I added this tip because I know that many WordPress users want to do this.

  5. Greg C. says:

    That is a great tip…but I have a quick question.

    In terms of SEO, do internal ping backs have a positive effect? Do I want to ping back my internal links?

    Thanks Fredrik

  6. Pingback: Martin's Toolbox » How to disable internal pingbacks in WordPress

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>