WPSEO_Sitemaps::send_headers()
Sends all the required HTTP Headers.
Метод класса: WPSEO_Sitemaps{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->send_headers();
Код WPSEO_Sitemaps::send_headers() WPSEO Sitemaps::send headers Yoast 22.4
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 ); } }