Disable notifications (pings) for your own posts

There are probably still WordPress users who have not disabled pings/notifications within their site and do not intend to do so, or simply do not know how. This post will be useful for you.

As for me, I don't like it when I link to a previously written article in my new post and then receive a notification (in the form of a comment) on my old post.

If this also bothers you and you want your old posts not to receive notifications from new posts, then insert the following code into the theme file functions.php:

// Disable pings for own posts (self pings)
add_action( 'pre_ping', 'kama_disable_inner_ping' );

function kama_disable_inner_ping( &$links ){

	foreach( $links as $k => $url ){
		if( false !== strpos( $url, str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) ) ){
			unset( $links[ $k ] );
		}
	}
}

For the curious, but not familiar with what the code does: before sending pings, an array with link addresses taken from the post is checked. If the link address contains your site's address: $_SERVER['HTTP_HOST'], then such a link is removed from the array, which means that no notifications will follow.

Completely disable notifications for article links

The above example shows how to disable pings only for your own posts, but if you need to completely disable all notifications, then go to "Discussion Settings" and uncheck "Attempt to notify any blogs linked to from the article":

With this complete disablement, you no longer need the previous code, because pings will not be sent at all!