canonical link for paginated page is not correct

1 day ago 4
ARTICLE AD BOX

Wordpress automatically adds the canonical link. I noticed, that for a paginated page the link is not correct. For instance with url:

https://example.xy/page/2

the canonical link in the head section shows:

<link rel="canonical" href="https://example.xy/2/">

href omits page/ and that is obviously not matching the url

expected link:

<link rel="canonical" href="https://example.xy/page/2">

Why is that?

As a temporary workaround i disabled canonical links:

remove_action( 'wp_head', 'rel_canonical');

For the page in question i added the canonical link manually in header-archivpage.php:

<link rel="canonical" href="<?php echo get_site_url(); ?>">

This seems to solve the problem for that specific page. But i still wonder why wordpress omits page/ ? Do you have any information about canonical links for a paginated page?

Read Entire Article