-
Hi
im just continuing this old thread https://support.rankmath.com/ticket/query-strings-paramters-exclude/
Basically what I would to ask is how to implement this on multiple parameters (not just single param)
add_filter( 'rank_math/frontend/robots', function( $robots ) { $url = home_url( $_SERVER['REQUEST_URI'] ); if(strpos($url,"?s=") !== false) { $robots['index'] = "noindex"; return $robots; }; return $robots; });
For example I have ?s=,?amp=,?noamp= where I like rankmath meta return noindex, tried this code on generatepress child function.php but it throws error
add_filter( 'rank_math/frontend/robots', function( $robots ) { $url = home_url( $_SERVER['REQUEST_URI'] ); if(strpos($url,"?q=","?max-results","?amp","?post_type","?page_id=") !== false) { $robots['index'] = "noindex"; return $robots; }; return $robots; });
Uncaught ArgumentCountError: strpos() expects at most 3 arguments, 6 given in wp-content/themes/generatepress_child/functions.php:5
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The ticket ‘noindex query parameter’ is closed to new replies.