Make WordPress Core


Ignore:
Timestamp:
06/16/2016 02:58:28 PM (9 years ago)
Author:
rachelbaker
Message:

REST API: Include X-Robots-Tag: noindex header in REST API responses to prevent endpoints from being indexed by search engines.

Prevent duplicate content issues with search engines and REST API endpoint response data.

Fixes #36390.
Props m_uysl for the initial patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r37674 r37726  
    227227        $content_type = isset( $_GET['_jsonp'] ) ? 'application/javascript' : 'application/json';
    228228        $this->send_header( 'Content-Type', $content_type . '; charset=' . get_option( 'blog_charset' ) );
     229        $this->send_header( 'X-Robots-Tag', 'noindex' );
    229230
    230231        /*
Note: See TracChangeset for help on using the changeset viewer.