wpcf7_get_contact_form_by_old_id()
Searches for a contact form by an old unit ID.
Хуков нет.
Возвращает
WPCF7_ContactForm
. Contact form object.
Использование
wpcf7_get_contact_form_by_old_id( $old_id );
- $old_id(int) (обязательный)
- Old unit ID.
Код wpcf7_get_contact_form_by_old_id() wpcf7 get contact form by old id CF7 5.9.8
function wpcf7_get_contact_form_by_old_id( $old_id ) { global $wpdb; $q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'" . $wpdb->prepare( " AND meta_value = %d", $old_id ); if ( $new_id = $wpdb->get_var( $q ) ) { return wpcf7_contact_form( $new_id ); } }