WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Function Reference/wp send json"

(include related JSON functions)
m (Usage)
Line 5: Line 5:
 
== Usage ==
 
== Usage ==
   
%%% <?php wp_send_json( $response ) ?> %%%
+
<?php wp_send_json( $response ) ?>
   
 
== Parameters ==
 
== Parameters ==

Revision as of 07:15, 14 December 2012

Description

Send a JSON response back to an Ajax request.

Usage

<?php wp_send_json( $response ) ?>

Parameters

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

Examples

Default Usage

Change Log

Source File

wp_send_json() is located in wp-includes/functions/php

Related

wp_send_json_success(), wp_send_json_error()