wpcf7_admin_save_button

The Contact Form 7 wpcf7 admin save button function.

Description

wpcf7_admin_save_button( $post_id ); 

Parameters (1)

0. $post_id
The post id.

Usage

  1. if ( !function_exists( 'wpcf7_admin_save_button' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/admin/edit-contact-form.php'; 
  3.  
  4. // The post id. 
  5. $post_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_admin_save_button($post_id); 
  9.  

Defined (1)

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

/admin/edit-contact-form.php  
  1. function wpcf7_admin_save_button( $post_id ) { 
  2. static $button = ''; 
  3.  
  4. if ( ! empty( $button ) ) { 
  5. echo $button; 
  6. return; 
  7.  
  8. $nonce = wp_create_nonce( 'wpcf7-save-contact-form_' . $post_id ); 
  9.  
  10. $onclick = sprintf( 
  11. "this.form._wpnonce.value = '%s';" 
  12. . " this.form.action.value = 'save';" 
  13. . " return true;",  
  14. $nonce ); 
  15.  
  16. $button = sprintf( 
  17. '<input type="submit" class="button-primary" name="wpcf7-save" value="%1$s" onclick="%2$s" />',  
  18. esc_attr( __( 'Save', 'contact-form-7' ) ),  
  19. $onclick ); 
  20.  
  21. echo $button;