The canonical link element isn’t set for all pages. For example, if I look at the source code for a post, I can see the following in the <head>
:
<link rel="canonical" href="http://example.com/post-name/" />
However, if I look at the source code for an author archive page, I don’t see the link element.
Why isn’t the canonical link element used for all pages?
Reference
I’ve included below the function used by WordPress to output the canonical link element.
/**
* Output rel=canonical for singular queries.
*
* @since 2.9.0
*/
function rel_canonical() {
if ( !is_singular() )
return;
global $wp_the_query;
if ( !$id = $wp_the_query->get_queried_object_id() )
return;
$link = get_permalink( $id );
if ( $page = get_query_var('cpage') )
$link = get_comments_pagenum_link( $page );
echo "<link rel="canonical" href="https://wordpress.stackexchange.com/questions/165192/$link" />\n";
}