wpcf7_get_contact_form_by_old_id

The Contact Form 7 wpcf7 get contact form by old id function.

Description

wpcf7_get_contact_form_by_old_id( $old_id ); 

Parameters (1)

0. $old_id
The old id.

Usage

  1. if ( !function_exists( 'wpcf7_get_contact_form_by_old_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/contact-form-functions.php'; 
  3.  
  4. // The old id. 
  5. $old_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_get_contact_form_by_old_id($old_id); 
  9.  

Defined (1)

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

/includes/contact-form-functions.php  
  1. function wpcf7_get_contact_form_by_old_id( $old_id ) { 
  2. global $wpdb; 
  3.  
  4. $q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'" 
  5. . $wpdb->prepare( " AND meta_value = %d", $old_id ); 
  6.  
  7. if ( $new_id = $wpdb->get_var( $q ) ) { 
  8. return wpcf7_contact_form( $new_id );