-
Hello,
I have a categories for example https://www.bioslunceluna.com/k/canabidiol/
And i wanna make all filter pages to be noindexed (all pages that include the following filters)
?orderby=popularity
?orderby=rating
?orderby=date
?orderby=price
?orderby=price-descI am using the following code in function.php, but its not working
// Noindex for filter queries
add_filter( ‘rank_math/frontend/robots’, function( $robots ) {
// Вземаме текущия URL
$url = home_url( $_SERVER[‘REQUEST_URI’] );// Проверяваме дали URL-то съдържа параметър ‘orderby’ с една от зададените стойности
if ( isset( $_GET[‘orderby’] ) && in_array( $_GET[‘orderby’], [‘popularity’, ‘rating’, ‘date’, ‘price’, ‘price-desc’] ) ) {
// Диагностика: отпечатваме текущия URL и стойността на ‘orderby’
error_log( ‘Noindex applied for: ‘ . $url );// Задаваме noindex за тези филтрирани URL-та
$robots[‘noindex’] = true;
$robots[‘follow’] = ‘follow’; // Можеш да оставиш следенето включено
}return $robots;
});Can you help me please.
Thank you
The ticket ‘Noindex category fillter pages’ is closed to new replies.