How To Remove WordPress Self Pings

How To Remove WordPress Self Pings

A self ping is when WordPress sends pings from your own site to your own site when you link to your own posts. They can appear in your comments area.

If you’re annoyed by self pings, here are three quick ways to turn them off:

Method #1: Turn them off in your functions.php file:

Add this to your theme’s functions.php file:

//remove pings to self
function no_self_ping( &$links ) {
$home = get_option( 'home' );
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, $home ) )
unset($links[$l]);
}
add_action( 'pre_ping', 'no_self_ping' );

Method #2: Install the No Self Pings plugin:

The No Self Pings plugin does exactly what the code above in method one does. It’s just in plugin form instead of you having to add it to your functions file. Some people like to keep fewer plugins. Others would rather not have to edit a PHP file. Take whatever solution suits you.