wpcf7_get_hangover

The Contact Form 7 wpcf7 get hangover function.

Description

wpcf7_get_hangover( (string) $name, (null) $default = null ); 

Parameters (2)

0. $name (string)
The name.
1. $default — Optional. (null) => null
The default.

Usage

  1. if ( !function_exists( 'wpcf7_get_hangover' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/contact-form-functions.php'; 
  3.  
  4. // The name. 
  5. $name = ''; 
  6.  
  7. // The default. 
  8. $default = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wpcf7_get_hangover($name, $default); 
  12.  

Defined (1)

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

/includes/contact-form-functions.php  
  1. function wpcf7_get_hangover( $name, $default = null ) { 
  2. if ( ! wpcf7_is_posted() ) { 
  3. return $default; 
  4.  
  5. $submission = WPCF7_Submission::get_instance(); 
  6.  
  7. if ( ! $submission || $submission->is( 'mail_sent' ) ) { 
  8. return $default; 
  9.  
  10. return isset( $_POST[$name] ) ? wp_unslash( $_POST[$name] ) : $default;