• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Alex Mustin
  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me
Alex Mustin
  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me
Alex Mustin

Alex Mustin

  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me
  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me

Disable Self-Pings in your WordPress Theme

April 16, 2015 in Code Snippets, Development

A well-known tactic for SEO called “interlinking” is when you link to your own posts. In WordPress, pingbacks are the equivalent of interlinking, and are automatically enabled by default. This can start to get annoying after a while when you are referencing other blog posts often… WordPress will automatically create a new comment about the pingback of that post. These pingback comments will appear in the comments section of your posts, and can start clogging up your comment list with something that looks like spam to other potential commenters.

To disable self-pingbacks from your own website, simply add the following lines of code to your functions.php file:

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]);
}

Filed Under: Code Snippets, Development

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer

Developing creative WordPress websites and solutions for companies of all sizes since 2008.

SOLUTIONS

  • One-Page Website
  • Maintenance Service

RESOURCES

  • Client Login
  • WordPress Tips
  • Mastodon

© 2025 Alex Mustin