• Resolved blueclochard

    (@blueclochard)


    Starting with 4.4 WordPress adds a new HTTP Header. It looks like this:

    Link: "<https://www.example.com/wp-json/>; rel="https://api.w.org/""

    Does anyone know how to remove it? I know the REST API can be disabled, but I still would like to remove the HTTP Header as well.

    Also starting with 4.4 old methods to remove the X-Pingback HTTP Header no longer work. This is the header I am talking about:

    X-Pingback: "https://www.example.com/xmlrpc.php"

    I would be very happy if anyone could tell me how to remove both of these headers.

Viewing 3 replies - 16 through 18 (of 18 total)
  • My problem with this requests is that they seem to be slowing down my site big time…

    I wonder if this would be solved by just installing the wp-json plugin…

    Analysis here:
    https://gtmetrix.com/reports/www.amara.pt/bSYFPfFE

    Moderator bcworkz

    (@bcworkz)

    @jose.bar.castro – Other than the unset Link bit, I fail to see how any of these would be degrading your site performance. All the lower scores in your linked analysis can be easily addressed except the deferred javascript, and they’re unrelated to measures here. The optimized images could be called “easily addressed” but in practice could be quite tedious if you have a lot of images.

    But if you have a lot of images this is probably your biggest gain. I wouldn’t use WP-JSON only because it is an old, unmaintained plugin. Unfortunately, WP based sites are never going to be top performers in page speed. Your best bet is to use a good caching plugin.

    To remove X-Pingback starting from WordPress version 4.4 you could do this:

    add_action('wp', function() {
        header_remove('X-Pingback');
    }, 1000);

    It’s hardcoded in wp-includes/class-wp.php in handle_404 function, so you’d need to hook as late as possible to remove this header.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘WP 4.4: remove json-api and X-Pingback from HTTP Headers’ is closed to new replies.