wpcf7_ajax_onload

The Contact Form 7 wpcf7 ajax onload function.

Description

wpcf7_ajax_onload(); 

Usage

  1. if ( !function_exists( 'wpcf7_ajax_onload' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/controller.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpcf7_ajax_onload(); 
  7.  

Defined (1)

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

/includes/controller.php  
  1. function wpcf7_ajax_onload() { 
  2. $echo = ''; 
  3. $items = array(); 
  4.  
  5. if ( isset( $_GET['_wpcf7'] ) 
  6. && $contact_form = wpcf7_contact_form( (int) $_GET['_wpcf7'] ) ) { 
  7. $items = apply_filters( 'wpcf7_ajax_onload', $items ); 
  8.  
  9. $echo = wp_json_encode( $items ); 
  10.  
  11. if ( wpcf7_is_xhr() ) { 
  12. @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); 
  13. echo $echo; 
  14.  
  15. exit();