Disable Self Pingbacks Without Plugin to keep your WordPress comments area clean and stop spammy notifications. Here’s how to do it with a simple tweak.
Step 1: Add the Self Pingbacks Disable Code
Add this to your child theme’s functions.php:
// Disable self pingbacks
function qdt_disable_self_pings( &$links ) {
foreach ( $links as $key => $link ) {
if ( strpos( $link, get_option( ‘home’ ) ) === 0 ) {
unset( $links[$key] );
}
}
}
add_action( ‘pre_ping’, ‘qdt_disable_self_pings’ );
How It Works
This function checks every outgoing link and removes any that point to your own site, stopping WordPress from pinging itself.
Why Disable Self Pingbacks Without Plugin?
Self pingbacks clutter your comments table with useless entries and spam notifications. They offer no real SEO or user benefit.
Common Mistake
This only disables self-pingbacks. External pingbacks or trackbacks from other sites still work if you allow them.
Pro Tip
Always add this tweak to your child theme’s functions.php so it stays active after updates.
Related Snippet
If you liked this, check out my guide on removing ?ver query strings without a plugin in WordPress.