# Disable Self-Pingbacks

> Stops WordPress from sending pingbacks to your own site when you link to your own posts, so they do not clutter the comment queue.

- Type: PHP
- Runs: Run everywhere
- Category: [Comments](https://wpide.com/library/category/comments/)
- Tags: comments, pingbacks
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/disable-self-pingbacks/

## Code

```php
add_action( 'pre_ping', function ( &$links ) {
    $home = home_url();

    foreach ( $links as $index => $link ) {
        if ( 0 === strpos( $link, $home ) ) {
            unset( $links[ $index ] );
        }
    }
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Disable Self-Pingbacks" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
