Skip to content

Instantly share code, notes, and snippets.

@bewho
Forked from glueckpress/disable_self_ping.php
Created October 10, 2018 01:50
Show Gist options
  • Save bewho/547b8e696609fcc26008d3eb7cbccc1d to your computer and use it in GitHub Desktop.
Save bewho/547b8e696609fcc26008d3eb7cbccc1d to your computer and use it in GitHub Desktop.
Disable self trackbacks from your own WordPress blog.
<?php
// Retrieved from: http://wp-snippets.com/disable-self-trackbacks/
add_action( 'pre_ping', 'disable_self_ping' );
function disable_self_ping( &$links ) {
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, get_option( 'home' ) ) )
unset($links[$l]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment