Disable or Remove Pings in wordpress
We all know the internal link is good for SEO as well as for user experience. Since WordPress 3.1 announced internal linking, many of us have been linking to our own preceding posts for good optimization. If you have tried internal linking on your site, you may have noticed the links displayed as a comment. This is called self-pings. For example, when you link POST A in your POST B, then due to ping-back, POST A appears in your comment section. Many people don’t like the idea of pingback whereas, I have seen many people enjoy it. Even I hate self-pings on my site.
A pingback or simply pings is a special type of comment that is created when you link to another post, as long as another blog is set to accept pingbacks.To create a pingback, just link to another WordPress blog post. If that post has pingbacks enabled, the owner of the blog will see a pingback appear in the comments section.
Can I Stop Self-Pings?
Yes, you certainly can stop the self-pings. Self-pings are useful to some but mostly annoying to others, including me.If you hate pings, you can stop your site from pinging itself by using a simple line of codes.
You may have thought l you’d need an extra plugin or would be problematic to fix this. You can find different plugins to remove pings, but why use studio lights when you can Sun? there’s no need of using an extra plugin when you can solve the self-tracking issue using a simple code.
Here’s the Code. Add it in your functions.php
file
function pp_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', 'pp_no_self_ping' );
Source: Stackexchange
You can also choose either to allow or disallow the pingbacks from the Discussion Settings of your Admin Dashboard. By ticking “attempt to notify any blogs linked to from the article“, WP will automatically notify blog owners when you link to them. In short, it will automatically send them a pingback.