• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WPSEO_Sitemaps::send_headers() – Sends all the required HTTP Headers.

You appear to be a bot. Output may be restricted

Description

Sends all the required HTTP Headers.

Usage

WPSEO_Sitemaps::send_headers();

Parameters

Returns

void

Source

File name: wordpress-seo/inc/sitemaps/class-sitemaps.php
Lines:

1 to 27 of 27
  private function send_headers() {
    if ( headers_sent() ) {
      return;
    }

    $headers = [
      $this->http_protocol . ' 200 OK' => 200,
      // Prevent the search engines from indexing the XML Sitemap.
      'X-Robots-Tag: noindex, follow'  => '',
      'Content-Type: text/xml; charset=' . esc_attr( $this->renderer->get_output_charset() ) => '',
    ];

    
/**
 * Filter the HTTP headers we send before an XML sitemap.
 *
 * @param array  $headers The HTTP headers we're going to send out.
 */
    $headers = apply_filters( 'wpseo_sitemap_http_headers', $headers );

    foreach ( $headers as $header => $status ) {
      if ( is_numeric( $status ) ) {
        header( $header, true, $status );
        continue;
      }
      header( $header, true );
    }
  }
 

 View on GitHub View on Trac

Published: 27th November 2019 | Last updated: 19th December 2019

Primary Sidebar

Information

Function name: WPSEO_Sitemaps::send_headers
Class ref: WPSEO_Sitemaps
Plugin ref: Yoast SEO
Version: 15.4
Sourcefile: inc/sitemaps/class-sitemaps.php
File ref: inc/sitemaps/class-sitemaps.php
Deprecated?: No
API Letters: H,S,W

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites