How to Stop Self Pingbacks in WordPress

Pings are a lot helpful if something relevant links to you but what if you start pinging yourself; isn’t it a bit annoying? It feels so weird to ping oneself, why would anybody wish to ping their own previously published posts? – Especially when there are so many better hyper-linking options available (think about ‘smart links’, ‘related posts’, etc.).

stop self pingback

If you have the pinging option enabled, WordPress generates self pings each time you link to your own posts. If you are you just tired of the self pings and want to opt out of it, here is the solution.

The easiest way, of course, is to install any of the available plugins for this, like No Self Pings. But if you do not wish to install a plugin and are game enough to touch your theme files, here is how you go about it:

1. Log in to your WordPress admin panel

2. Navigate to Appearance >> Editor >> Functions.php

3. Start editing it, put the below given code in the functions.php file you are editing

//remove self pings
 function no_self_ping( &$links ) {
 $home = get_option( ‘home’ );
 foreach ( $links as $l => $link )
 if ( 0 === strpos( $link, $home ) )
 add_action( ‘pre_ping’, ‘no_self_ping’ );

Once you have this code in your functions.php file, save it by clicking on the Update File option. Great, you are done!