Make WordPress Core


Ignore:
Timestamp:
05/26/2026 12:17:59 AM (4 months ago)
Author:
ramonopoly
Message:

Disable pings/trackbacks for local, development, and staging environments

When WP_ENVIRONMENT_TYPE is not production, disable pingbacks and trackbacks.

Otherwise, when WP_ENVIRONMENT_TYPE is localdevelopment, or staging, pingbacks and trackbacks are sent when posts are published. This creates confusion on the receiving end and is unnecessary for testing workflows.

Props arcangelini, cagrimmett, ramonopoly, tyxla, khushipatel15.

Fixes #64837.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r62349 r62417  
    422422add_action( 'do_all_pings', 'do_all_trackbacks', 10, 0 );
    423423add_action( 'do_all_pings', 'generic_ping', 10, 0 );
     424
     425// Disable pings (pingbacks, trackbacks, and ping service notifications) in non-production environments.
     426add_action( 'do_all_pings', 'wp_maybe_disable_outgoing_pings_for_environment', 1, 0 );
     427add_action( 'pre_trackback_post', 'wp_maybe_disable_trackback_for_environment', 10, 0 );
     428add_filter( 'xmlrpc_methods', 'wp_maybe_disable_xmlrpc_pingback_for_environment' );
     429
    424430add_action( 'do_robots', 'do_robots' );
    425431add_action( 'do_favicon', 'do_favicon' );
Note: See TracChangeset for help on using the changeset viewer.