Я скрыл определении категории из главного страницы магазина, и тот категории которые я скрыл добавил в отдельную страницу, все работает нормально так как я хотел но когда я нажимаю на категорию открывается страница и пишет что нету товаров



вот код с которого я скрыл
function custom_pre_get_posts_query( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'cups' , 'souvenirs'), // Don't display products in the clothing category on the shop page.
'operator' => 'NOT IN'
);
$q->set( 'tax_query', $tax_query );
}
add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );