W3cubDocs

/WordPress

WP_Sitemaps_Renderer::check_for_simple_xml_availability()

Checks for the availability of the SimpleXML extension and errors if missing.

Source

private function check_for_simple_xml_availability() {
	if ( ! class_exists( 'SimpleXMLElement' ) ) {
		add_filter(
			'wp_die_handler',
			static function () {
				return '_xml_wp_die_handler';
			}
		);

		wp_die(
			sprintf(
				/* translators: %s: SimpleXML */
				esc_xml( __( 'Could not generate XML sitemap due to missing %s extension' ) ),
				'SimpleXML'
			),
			esc_xml( __( 'WordPress › Error' ) ),
			array(
				'response' => 501, // "Not implemented".
			)
		);
	}
}

Changelog

Version Description
5.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_sitemaps_renderer/check_for_simple_xml_availability