wp_super_cache_query_vars()
No Hooks.
Returns
null. Nothing (null).
Usage
wp_super_cache_query_vars();
wp_super_cache_query_vars() wp super cache query vars code WPSCache 3.1.0
function wp_super_cache_query_vars() {
global $wp_super_cache_query;
if ( is_search() ) {
$wp_super_cache_query['is_search'] = 1;
}
if ( is_page() ) {
$wp_super_cache_query['is_page'] = 1;
}
if ( is_archive() ) {
$wp_super_cache_query['is_archive'] = 1;
}
if ( is_tag() ) {
$wp_super_cache_query['is_tag'] = 1;
}
if ( is_single() ) {
$wp_super_cache_query['is_single'] = 1;
}
if ( is_category() ) {
$wp_super_cache_query['is_category'] = 1;
}
if ( is_front_page() ) {
$wp_super_cache_query['is_front_page'] = 1;
}
if ( is_home() ) {
$wp_super_cache_query['is_home'] = 1;
}
if ( is_author() ) {
$wp_super_cache_query['is_author'] = 1;
}
// REST API
if ( ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
( defined( 'JSON_REQUEST' ) && JSON_REQUEST ) ||
( defined( 'WC_API_REQUEST' ) && WC_API_REQUEST )
) {
$wp_super_cache_query['is_rest'] = 1;
}
// Feeds, sitemaps and robots.txt
if ( is_feed() ) {
$wp_super_cache_query['is_feed'] = 1;
if ( get_query_var( 'feed' ) == 'sitemap' ) {
$wp_super_cache_query['is_sitemap'] = 1;
}
} elseif ( get_query_var( 'sitemap' ) || get_query_var( 'xsl' ) || get_query_var( 'xml_sitemap' ) ) {
$wp_super_cache_query['is_feed'] = 1;
$wp_super_cache_query['is_sitemap'] = 1;
} elseif ( is_robots() ) {
$wp_super_cache_query['is_robots'] = 1;
}
// Reset everything if it's 404
if ( is_404() ) {
$wp_super_cache_query = array( 'is_404' => 1 );
}
return $wp_super_cache_query;
}