Initiates all sitemap functionality.

Description Description

If sitemaps are disabled, only the rewrite rules will be registered by this method, in order to properly send 404s.

Top ↑

Source Source

File: wp-includes/sitemaps/class-wp-sitemaps.php

	public function init() {
		// These will all fire on the init hook.

		add_action( 'template_redirect', array( $this, 'render_sitemaps' ) );

		if ( ! $this->sitemaps_enabled() ) {


		// Add additional action callbacks.
		add_filter( 'pre_handle_404', array( $this, 'redirect_sitemapxml' ), 10, 2 );
		add_filter( 'robots_txt', array( $this, 'add_robots' ), 0, 2 );

Top ↑

Changelog Changelog

Version Description
5.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.