Guest User

Untitled

a guest
Aug 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. /*
  2. By default Wordpress will ping itself with each internal link.
  3.  
  4. This is annoying and a tad inefficient. To disable:
  5. 1. Open your Wordpress theme's functions.php file located in /wp-content/themes/[YOUR THEME]/
  6. 2. Paste the code snippet below into your functions.php
  7. 3. Save to have the changes take effect.
  8. */
  9.  
  10. function disable_self_pings( &$links ) {
  11. foreach ( $links as $i => $link )
  12. if ( 0 === strpos( $link, get_option( 'home' ) ) )
  13. unset($links[$i]);
  14. }
  15.  
  16. add_action( 'pre_ping', 'disable_self_pings' );
Add Comment
Please, Sign In to add comment