-
Hi RankMath team,
Thanks for the great plugin!
I face issue with not being able to set canonical URL for archive pages.
My case is: I have custom post types ( ex. movies ) that can be filtered.
site.com/movies/ => archive page
site.com/movies/?order=ASC => Archive page, movies order ASC by title
site.com/movies/?order=DESC => Archive page, movies order DESC by titleI want to set canonical url but it doesn’t seems to work:
`
add_filter( ‘rank_math/frontend/canonical’, function( $canonical ) {
global $wp_query;
var_dump();
if($wp_query->query[‘order’]){
$canonical = ‘site.com/movies/’;return $canonical;
}
return $canonical;
});
`
However the link rel=”canonical” does not show on the front-end
The ticket ‘Archive pages canonical URLs’ is closed to new replies.