Categories
WordPress

Preventing Self Pings

If you have pingbacks switched on for your WordPress site i on new articles’) then one annoyance is ‘self pings’ when you link to one of your posts from another.

Well, self pings can be prevented with a simple script, added to your functions.php file.

<?php
function no_self_pings( $links ) {
foreach ( $links as $loop => $link ) {
if ( 0 === strpos( $link, get_option( 'home' ) ) ) { unset( $links[ $loop ] ); }
}
}
add_action( 'pre_ping', 'no_self_pings' );
?>
view raw functions.php hosted with ❤ by GitHub

And that’s it. There are no settings – just peace in your inbox.

  1. Settings -> Discussion and then tick ‘Allow link notifications from other blogs (pingbacks and trackbacks[]

Talk to me!

This site uses Akismet to reduce spam. Learn how your comment data is processed.

css.php
%d bloggers like this: