Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dartiss
Created November 14, 2017 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dartiss/120a42eda1998f64b77d32e1fff6fc67 to your computer and use it in GitHub Desktop.
Save dartiss/120a42eda1998f64b77d32e1fff6fc67 to your computer and use it in GitHub Desktop.
No Self Pings
<?php
function no_self_pings( $links ) {
foreach ( $links as $loop => $link ) {
if ( 0 === strpos( $link, get_option( 'home' ) ) ) { unset( $links[ $loop ] ); }
}
}
add_action( 'pre_ping', 'no_self_pings' );
?>
@dartiss
Copy link
Author

dartiss commented Nov 14, 2017

Add to your WordPress functions.php to prevent your site from self-pinging when you add a link to one of your own posts.

https://artiss.blog/2017/03/preventing-self-pings/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment