wpcf7_get_contact_form_by_old_id()CF7 1.0

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() CF7 6.1.7

function wpcf7_get_contact_form_by_old_id( $old_id ) {
	$contact_forms = WPCF7_ContactForm::find( array(
		'meta_query' => array(
			array(
				'key' => '_old_cf7_unit_id',
				'type' => 'DECIMAL',
				'value' => $old_id,
			),
		),
		'posts_per_page' => 1,
	) );

	if ( $contact_forms ) {
		return wpcf7_contact_form( $contact_forms[0] );
	}
}