Files
profile/inc/rossiya.php
Profile Profile ed4d79b706 add files inc
2026-03-09 20:51:08 +03:00

24 lines
876 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
function replace_category_with_tag($query) {
// Проверяем, что это главный запрос и не в админке
if (!$query->is_main_query() || is_admin()) {
return;
}
// Проверяем, что это архив рубрики с ID 3347
if ($query->is_category(3347)) {
// Убираем фильтр по категории
$query->set('cat', '');
$query->set('category__in', '');
// Устанавливаем фильтр по тегу
$query->set('tag', 'rossiya');
// Сбрасываем флаги, чтобы WordPress думал, что это архив тега
$query->is_category = false;
$query->is_tag = true;
$query->is_archive = true;
}
}
add_action('pre_get_posts', 'replace_category_with_tag');