Canonical tag missing for AMP pages

[ad_1]

After updating to v4.2.4, AMP pages no longer have a rel canonical tag.
It must be caused by the following code:


if ( ! empty( $canonical ) && ! aioseo()->helpers->isAmpPage( 'amp' ) ) :
	?>
		<link rel="canonical" href="<?php echo esc_url( $canonical ); ?>" />

But, without this tag, Google complains about such AMP pages:

Referenced AMP URL is self-canonical AMP
AMP pages with this issue are invalid. Invalid AMP pages aren’t served on Google

What was the point of removing the canonical tag and how can it be fixed?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer