At present all https pages have their own canonical tags referencing https, which is incorrect, they should be referencing the http versions.
e.g:
https://www.example.com
has the following canonical tag:
<link rel="canonical" href="https://www.example.com" />
How can we make the canonical tags on https pages use the http URLs?
3 Answers
You can change it using following code, add it in your theme function.php or in plugin.
remove_action ( 'wp_head' , 'rel_canonical' ) ;
add_action ( 'wp_head' , 'my_rel_canonical' ) ;
function my_rel_canonical () {
ob_start () ;
rel_canonical () ;
$rel_content = ob_get_contents () ;
ob_end_clean () ;
echo str_replace ( "https:" , "http:" , $rel_content ) ;
}