Detecting canonical URL
-
Yoast SEO detects canonical URL. Is this possible to use outside the plugin. For example, I want to show the hreflang=”x” tag only on the canonical pages and would like to use something like
if( $WPSEO_Frontend->is_canonical ) { echo '<link rel="alternate" hreflang="es" href="https://es.example.com/" />' }
Is there a way to do so?
- The topic ‘Detecting canonical URL’ is closed to new replies.