要禁用pingback和trackback,请将此代码添加到functions.php 子主题中的文件:
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;
}
 或者,您可以使用
Disable Blogging 插件,负责为您禁用pingback/trackback。