wpseo_ajax_json_echo_die

Convenience function to JSON encode and echo results and then die.

Description

wpseo_ajax_json_echo_die( (array) $results ); 

Parameters (1)

0. $results (array)
Results array for encoding.

Usage

  1. if ( !function_exists( 'wpseo_ajax_json_echo_die' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/admin/ajax.php'; 
  3.  
  4. // Results array for encoding. 
  5. $results = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpseo_ajax_json_echo_die($results); 
  9.  

Defined (1)

The function is defined in the following location(s).

/admin/ajax.php  
  1. function wpseo_ajax_json_echo_die( $results ) { 
  2. echo wp_json_encode( $results ); 
  3. die();