Скрыть категорию
-
Всем привет. Помогите скрыть категорию. Я пробовал вот такое решение
add_filter( 'get_terms', 'organicweb_exclude_category', 10, 3 ); function organicweb_exclude_category( $terms, $taxonomies, $args ) { $new_terms = array(); // if a product category and on a page if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() && is_page() ) { foreach ( $terms as $key => $term ) { // Enter the name of the category you want to exclude in place of 'uncategorised' if ( ! in_array( $term->slug, array( 'chips' ) ) ) { $new_terms[] = $term; } } $terms = $new_terms; } return $terms; }
Что то оно не срабатывает, категория не пропадает со страницы магазина. Плагины пробовал ставить, но они не видят категорий woocommerce.
Просмотр 8 ответов — с 1 по 8 (всего 8)
Просмотр 8 ответов — с 1 по 8 (всего 8)
- Тема «Скрыть категорию» закрыта для новых ответов.