WPCF7_ContactForm::get_instance()public staticCF7 1.0

Creates a WPCF7_ContactForm object and sets it as the current instance.

Метод класса: WPCF7_ContactForm{}

Хуков нет.

Возвращает

WPCF7_ContactForm|null. Contact form object. Null if unset.

Использование

$result = WPCF7_ContactForm::get_instance( $post );
$post(WPCF7_ContactForm|WP_Post|int) (обязательный)
Object or post ID.

Код WPCF7_ContactForm::get_instance() CF7 5.9.8

public static function get_instance( $post ) {
	$contact_form = null;

	if ( $post instanceof self ) {
		$contact_form = $post;
	} elseif ( ! empty( $post ) ) {
		$post = get_post( $post );

		if ( isset( $post ) and self::post_type === get_post_type( $post ) ) {
			$contact_form = new self( $post );
		}
	}

	return self::$current = $contact_form;
}