canonical link on mobile site
-
Hello,
Moved a couple of days ago from Yoast, and I like what I see.
However, I have one problem:
Technically, my site consist of two wordpress installs: one for the desktop site (domain.com) and one for the mobile site (m.domain.com)
On m.domain.com, the canonical link is m.domain.com, while it should be domain.com.
So, how can I change this with a filter?
I tried
/** * Set canonical url to desktop site */ add_filter( 'rank_math/frontend/canonical', function( $canonical ) { $custom_url = RankMath\Post::get_meta( 'canonical_url', get_the_ID() ); if ( $custom_url ) { $canonical = ltrim($custom_url,"m."); } return $canonical; });
but this is obviously not working…
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘canonical link on mobile site’ is closed to new replies.