How To Remove WordPress X-Pingback headers

WordPress uses XMLRPC for Pingback and Trackback. This can cause security problem sometimes. 

It’s better to remove WordPress X-Pingback headers. There is a very simple snippet which will do this job for you. I will show you two different method for solving the issue. 

Remove WordPress X-Pingback header via function.php

Login to your Cpanel or FTP first. Go to your active Theme directory and edit the function.php file. 

If you don’t have Cpanel or FTP access then you can do it from your dashboard too. Just navigate to Appreance>Editor. Select your active Theme and click on function.php file. 

copy the following code and paste it inside your function.php file.

				
					// Remove X-Pingback
add_filter('wp_headers', 'jltwp_adminify_remove_pingback_head');
add_action('wp', 'jltwp_adminify_remove_pingback');
function jltwp_adminify_remove_pingback_head($headers)
{
    if (isset($headers['X-Pingback'])) {
        unset($headers['X-Pingback']);
    }
    return $headers;
}

function jltwp_adminify_remove_pingback()
{
    if (function_exists('header_remove')) {
        header_remove('X-Pingback');
    }
}

				
			

There is a option in Settings> Discussion>Default post settings called “Allow link notifications from other blogs (pingbacks and trackbacks) on new posts“. 

Allow link notifications from other blogs

If you uncheck this tick mark and save changes, then WordPress won’t notify you about link notification from pingbacks.

Remove WordPress X-Pingback using Adminify Plugin

The following steps will work if you have already installed and activated WP Adminify plugin.

After log in to the dashboard Navigate to WP Adminify> tweaks> HTTP Response

Check the third option named “Remove X-Pingback from HTTP Headers“. Just enable this and save settings. Your WordPress X-Pingback and Trackback will be removed. 

remove x pingback from http headers
Was this article helpful?

© 2021 - Adminify | All rights reserved

WP Adminfy accepted payment methods