Disable Self Pingbacks on WordPress

Self-pingbacks are annoying and it is one of the first things I disable after setting up a WordPress site.

Here’s the code to disable self-pingbacks on WordPress:

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

How to add this code to your WordPress site

Leave a Comment