WPDev.one
Core Function
View Source on Trac ↗

wp_send_json()

wp_send_json( mixed $response, mixed $status_code = null, mixed $flags = 0 )

Sends a JSON response back to an Ajax request.

Parameters 1 required

Name / Type Description
mixed

$response Variable (usually an array or object) to encode as JSON, then print and die.

Required
$status_code
int

Optional. The HTTP status code to output. Default null.

$flags
int

Optional. Options to be passed to json_encode(). Default 0.

Return Value

(void)
No return value description available.

Function Information

Since Version
3.5.0
Source File
wp-includes/functions.php
Advertisement