I'm trying to disable pingback / trackback email notifications and was wondering if there's a PHP file I can edit to prevent them?

I've disabled them in the main WordPress settings (which I think just changes the default on new posts?) but still getting notifications of trackbacks on a post that's actually not a real post but a portfolio item in a portfolio plugin (with no option of disabling them on a per-post basis).

  • has this question bee resolved? Did my answer help? Aug 23, 2016 at 12:43

1 Answer 1


To disable pingback and trackbacks, add this code to your functions.php file in your child theme:

add_action( 'pre_ping', 'wpse_190346_internal_pingbacks' );
add_filter( 'wp_headers', 'wpse_190346_x_pingback');
add_filter( 'bloginfo_url', 'wpse_190346_pingback_url') ;
add_filter( 'bloginfo', 'wpse_190346_pingback_url') ;
add_filter( 'xmlrpc_enabled', '__return_false' );
add_filter( 'xmlrpc_methods', 'wpse_190346_xmlrpc_methods' );

function wpse_190346_internal_pingbacks( &$links ) { // Disable internal pingbacks
    foreach ( $links as $l => $link ) {
        if ( 0 === strpos( $link, get_option( 'home' ) ) ) {
            unset( $links[$l] );
function wpse_190346_x_pingback( $headers ) { // Disable x-pingback
    unset( $headers['X-Pingback'] );
    return $headers;
function wpse_190346_pingback_url( $output, $show='') { // Remove pingback URLs
    if ( $show == 'pingback_url' ) $output = '';
    return $output;
function wpse_190346_xmlrpc_methods( $methods ) { // Disable XML-RPC methods
    unset( $methods['pingback.ping'] );
    return $methods;

Alternatively, you can use the Disable Blogging plugin which takes care of disabling the pingback/trackbacks for you.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .