WordPress can create unnecessary self-pingbacks when you link to your own posts internally. Disabling them helps keep comments cleaner and reduces extra requests.
Steps
- Open your WordPress theme
functions.phpfile. - Add the code below at the end of the file.
- Save the file.
- Publish or update a post to test it.
Done — WordPress will stop sending pingbacks to your own website.
function disable_self_pingbacks(&$links) {
foreach ($links as $l => $link) {
if (0 === strpos($link, home_url())) {
unset($links[$l]);
}
}
}
add_action('pre_ping', 'disable_self_pingbacks');