Noindex endpoints

Closes #10433
This commit is contained in:
Mike Jolley 2016-02-29 12:52:45 +00:00
parent 14e03038e3
commit 8edf6d9286
1 changed files with 22 additions and 9 deletions

View File

@ -182,6 +182,11 @@ class WC_Cache_Helper {
}
}
}
// Noindex for endpoints
if ( is_wc_endpoint_url() || isset( $_GET['download_file'] ) ) {
self::noindex();
}
}
/**
@ -189,18 +194,26 @@ class WC_Cache_Helper {
* @access private
*/
private static function nocache() {
if ( ! defined( 'DONOTCACHEPAGE' ) )
define( "DONOTCACHEPAGE", "true" );
if ( ! defined( 'DONOTCACHEOBJECT' ) )
define( "DONOTCACHEOBJECT", "true" );
if ( ! defined( 'DONOTCACHEDB' ) )
define( "DONOTCACHEDB", "true" );
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
define( "DONOTCACHEPAGE", true );
}
if ( ! defined( 'DONOTCACHEOBJECT' ) ) {
define( "DONOTCACHEOBJECT", true );
}
if ( ! defined( 'DONOTCACHEDB' ) ) {
define( "DONOTCACHEDB", true );
}
nocache_headers();
}
/**
* Set noindex headers.
* @access private
*/
private static function noindex() {
@header( 'X-Robots-Tag: noindex' );
}
/**
* notices function.
*/