Stop Pingbacks on WordPress From Showing In Comments

by Josh Koop | Last Updated: July 22, 2020
As an Amazon Associate we earn from qualifying purchases made on our website. If you make a purchase through links from this website, we may get a small share of the sale from Amazon and other similar affiliate programs. You can read our complete disclaimer information for more details.

For anyone who gets irritated with pingbacks to their posts when they link them the code below you can add to a [ Code Snippets ] Plugin to stop these from running on your blog.

Install the Code Snippets Plugin

  1. New Code Snippet
  2. Title: Stop Self Pingbacks
  3. Code: Paste the below code block
  4. Set To Run Snippet Everywhere
  5. Save Changes and Activate
function no_self_ping( &$links ) {
    $home = get_option( 'home' );
    foreach ( $links as $l => $link )
        if ( 0 === strpos( $link, $home ) )
            unset($links[$l]);
}
 
add_action( 'pre_ping', 'no_self_ping' );
I love technology, I have plenty of technical side experience but never really thought of blogging as a way to earn an income. With everything that has gone on in the last couple years and the instability of the job markets I started to learn how to blog and build affiliate niche sites to add more income channels to give me the chance to break free from the financial chains that bind me and find real freedom!