WC_Install::page_createdpublic staticWC 5.6.0

When pages are created, we might want to take some action. In this case we want to create an admin note when the refund and returns page is created.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Install::page_created( $page_id, $page_data );
$page_id(int) (обязательный)
ID of the page.
$page_data(массив) (обязательный)
The data of the page created.

Список изменений

С версии 5.6.0 Введена.

Код WC_Install::page_created() WC 10.7.0

public static function page_created( $page_id, $page_data ) {
	if ( Constants::is_true( 'WC_INSTALLING' ) ) {
		return;
	}

	if ( 'refund_returns' === $page_data['post_name'] && class_exists( 'WC_Notes_Refund_Returns', false ) ) {
		$callback = fn() => WC_Notes_Refund_Returns::possibly_add_note( $page_id );

		if ( did_action( 'init' ) ) {
			$callback();
		} else {
			add_action( 'init', $callback );
		}
	}
}