Canonical Self Referential for Elementor pagination

#512853
  • Resolved Rafael
    Rank Math free

    I have created a product grid with Elementor which is creating pages with the following format: /category/
    /category/?product-page=2

    What I’ve right now, is that for each ?product-page=2 the canonical is pointing to the first page: /category/, instead of doing a self-reference. Is it possible to change this so each paginated page has it’s own self-reference?

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

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Please try adding the following filter in order to set self-referencing canonical for paginated product URLs on your site.

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    	$url = home_url( $_SERVER['REQUEST_URI'] );
    	if(strpos($url, '?product-page=')) {
    	$canonical = $url;
    	}
        return $canonical;
    });

    Here’s how you can add filters/hooks to your site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Rafael
    Rank Math free

    Hello Sakib,

    It worked! Thanks for your quick reply.

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post 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 ‘Canonical Self Referential for Elementor pagination’ is closed to new replies.