Code to Disable Self-Pingbacks (Self-Comments) in WordPress

/* Disable Self-Commenting Pingbacks WordPress */
function wpflt_disable_self_ping_comment( &$links ) {
    $home = get_option( 'home' );
    foreach ( $links as $l => $link )
    if ( 0 === strpos( $link, $home ) )
    unset($links[$l]);
}
add_action( 'pre_ping', 'wpflt_disable_self_ping_comment' );

Most users enable pinging option in WordPress for backlinking. However, when you write/update a post on your site consisting a link of another post of your own site, WordPress will automatically post a comment called as self-pingback.

To disable WordPress commenting on your own posts, disable self pingbacks by adding the provided code to your child theme’s functions.php.