• Hello,

    I faced a little problem. I have a CPT for reviews (not publicly queryable) and a page where I query them with pagination. I came up with this code:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    global $wp;

    if ( is_page( 'otzyvy' ) && is_paged() ) {
    $canonical = home_url( trailingslashit( $wp->request ) );
    }

    return $canonical;
    });

    To make canonical meta-tag to referring to paginated page, not the main one. But got an issue: the %page% dynamic tag doesn’t work (page 1 of 3 is not appeared in title nor description).

Viewing 1 replies (of 1 total)
  • Plugin Support Jaideep Asrani

    (@jaideeprm)

    Hello @tw1l1ght,

    Thank you for contacting Rank Math support.

    Since the %page% variable is not working for CPT, please modify and use the following filter to add the page number to the SEO title of the paginated pages:

    add_filter( 'rank_math/frontend/title', function( $title ) {
    if(is_paged()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    return $title. ' Page '.$paged;
    }
    return $title;
    });

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.