WC_Admin_Post_Types::hide_cpt_archive_templates()publicWC 1.0

When editing the shop page, we should hide templates.

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

Хуков нет.

Возвращает

Массив.

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

$WC_Admin_Post_Types = new WC_Admin_Post_Types();
$WC_Admin_Post_Types->hide_cpt_archive_templates( $page_templates, $theme, $post );
$page_templates(массив) (обязательный)
Templates array.
$theme(строка) (обязательный)
Classname.
$post(WP_Post) (обязательный)
The current post object.

Код WC_Admin_Post_Types::hide_cpt_archive_templates() WC 8.7.0

public function hide_cpt_archive_templates( $page_templates, $theme, $post ) {
	$shop_page_id = wc_get_page_id( 'shop' );

	if ( $post && absint( $post->ID ) === $shop_page_id ) {
		$page_templates = array();
	}

	return $page_templates;
}