From ceeb99ecbccf317eda5ff2739da2c722ecadd5fe Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 17 Jul 2019 01:10:59 +0000 Subject: [PATCH] Administration: In `admin-ajax.php`, send `X-Robots-Tag` header earlier, so that it applies before `wp_die()` when no action parameter was provided. Props robi-bobi, harryfear, garrett-eclipse. Fixes #47711. git-svn-id: https://develop.svn.wordpress.org/trunk@45650 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/admin-ajax.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/admin-ajax.php b/src/wp-admin/admin-ajax.php index f284387945..6be4a87a13 100644 --- a/src/wp-admin/admin-ajax.php +++ b/src/wp-admin/admin-ajax.php @@ -24,6 +24,9 @@ require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); /** Allow for cross-domain requests (from the front end). */ send_origin_headers(); +header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); +header( 'X-Robots-Tag: noindex' ); + // Require an action parameter if ( empty( $_REQUEST['action'] ) ) { wp_die( '0', 400 ); @@ -35,9 +38,6 @@ require_once( ABSPATH . 'wp-admin/includes/admin.php' ); /** Load Ajax Handlers for WordPress Core */ require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' ); -header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); -header( 'X-Robots-Tag: noindex' ); - send_nosniff_header(); nocache_headers();