WC_Admin_Meta_Boxes::remove_block_templates()
Remove block-based templates from the list of available templates for products.
{} Это метод класса: WC_Admin_Meta_Boxes{}
Хуков нет.
Возвращает
Строку[]
. Templates array excluding block-based templates.
Использование
$WC_Admin_Meta_Boxes = new WC_Admin_Meta_Boxes(); $WC_Admin_Meta_Boxes->remove_block_templates( $templates );
- $templates(string[]) (обязательный)
- Array of template header names keyed by the template file name.
Код WC_Admin_Meta_Boxes::remove_block_templates() WC Admin Meta Boxes::remove block templates WC 6.4.1
public function remove_block_templates( $templates ) { if ( count( $templates ) === 0 || ! function_exists( 'gutenberg_get_block_template' ) ) { return $templates; } $theme = wp_get_theme()->get_stylesheet(); $filtered_templates = array(); foreach ( $templates as $template_key => $template_name ) { $gutenberg_template = gutenberg_get_block_template( $theme . '//' . $template_key ); if ( ! $gutenberg_template ) { $filtered_templates[ $template_key ] = $template_name; } } return $filtered_templates; }