WordPress – fix canonical URL

function gallery_canonical($url) {
return site_url($_SERVER[‘REQUEST_URI’]);
}

add_filter( ‘wpseo_canonical’, ‘gallery_canonical’ );

add_filter( ‘wpseo_opengraph_url’, ‘gallery_canonical’ );

Back to Top