Documentation / Tutorials / Known Issues & Fixes
Programmatically customizing the canonical URLs of a Taxonomy using Yoast SEO
/ Known Issues & Fixes / Programmatically customizing the canonical URLs of a Taxonomy using Yoast SEO
If are using Yoast SEO plugin along with Awesome Studio and you need to change the canonical URL generated by Yoast, then put the function mentioned below in your site-specific plugin. Just remember you will need to change the tag_category in the example below with actual taxonomy you are using.
function yoast_seo_canonical_change_wpoets( $canonical ) { if ( !is_tax( 'tag_category' ) ) { return $canonical; } $url= site_url().'/products/'.get_query_var( 'term' ).'/'; return $url; } add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_wpoets', 10, 1 );