wp-includes/functions.php:4513Sends a JSON response back to an Ajax request.
$responsemixed$status_codeintoptionalnull$flagsintoptional0function wp_send_json( $response, $status_code = null, $flags = 0 ) { if ( wp_is_serving_rest_request() ) { _doing_it_wrong( __FUNCTION__, sprintf( /* translators: 1: WP_REST_Response, 2: WP_Error */ __( 'Return a %1$s or %2$s object from your callback when using the REST API.' ), 'WP_REST_Response', 'WP_Error' ), '5.5.0' ); } if ( ! headers_sent() ) { header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); if ( null !== $status_code ) { status_header( $status_code ); } } echo wp_json_encode( $response, $flags ); if ( wp_doing_ajax() ) { wp_die( '', '', array( 'response' => null, ) ); } else { die; }}Introduced in 3.5.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
none to never.verified against sourcesrc/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.