[wp-trac] [WordPress Trac] #64837: Disable pings/trackbacks for local, development, and staging environments
WordPress Trac
noreply at wordpress.org
Tue Apr 14 10:53:11 UTC 2026
#64837: Disable pings/trackbacks for local, development, and staging environments
--------------------------------------+-------------------------
Reporter: cagrimmett | Owner: ramonopoly
Type: enhancement | Status: reopened
Priority: normal | Milestone: 7.1
Component: Pings/Trackbacks | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-------------------------
Comment (by khushipatel15):
@swissspidy , we can use this function instead ?
{{{
function mytheme_disable_pings_in_dev() {
$env_type = wp_get_environment_type();
if (apply_filters('wp_override_disable_pings_trackbacks_in_dev_envs',
false, $env_type)) {
return false;
}
return in_array($env_type, ['local', 'development', 'staging'], true);
}
add_filter('pre_pingback_send', function ($send) {
return mytheme_disable_pings_in_dev() ? false : $send;
});
add_filter('xmlrpc_methods', function ($methods) {
if (mytheme_disable_pings_in_dev() &&
isset($methods['pingback.ping'])) {
unset($methods['pingback.ping']);
}
return $methods;
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64837#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list