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:

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

//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.