Archive pages canonical URLs

  • Resolved Christo Panayotoff
    Rank Math free

    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. => archive page => Archive page, movies order ASC by title => Archive page, movies order DESC by title

    I want to set canonical url but it doesn’t seems to work:

    add_filter( ‘rank_math/frontend/canonical’, function( $canonical ) {
    global $wp_query;
    $canonical = ‘’;

    return $canonical;
    return $canonical;

    However the link rel=”canonical” does not show on the front-end

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math today.

    Do you wish the canonical to include the current page inclusive of the order term?.

    Please note that Rank math can add canonical URLs to your pages automatically, but only if they are set to index.

    If you want us to check this further, please share some of the affected URLs with us in the sensitive section

    Looking forward to helping you. Thank you.



    The problem was mine – I tried to see the canonical link on the archive page, not when filtering is applied, also bug in my code. Fixed it and all is working now. Will leave the theme here so if anyone face similar issue can benefit from the thread.



    We are glad it is all resolved now.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Archive pages canonical URLs’ is closed to new replies.