WP_Ajax_Response::send()
Display XML formatted responses.
Description
Sets the content type header to text/xml.
More Information
This will set the correct content type for the header, output the response xml, then die – ensuring a proper XML response.
Source
File: wp-includes/class-wp-ajax-response.php
public function send() {
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>";
foreach ( (array) $this->responses as $response ) {
echo $response;
}
echo '</wp_ajax>';
if ( wp_doing_ajax() ) {
wp_die();
} else {
die();
}
}
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_ajax_response/send