How to turn off pingbacks inside WordPress

I have tried to disable pingbacks inside WordPress.
Can be improved the following code?

// Disable self-pingbacks
function stop_self_ping( &$links ) {
    $home = get_option( 'home' );
    foreach ( $links as $l => $link )
        if ( 0 === strpos( $link, $home ) )
            unset($links[$l]);
}
 
add_action( 'pre_ping', 'stop_self_ping' );

Your code is already good in terms of disabling self-pingbacks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.