Skip to content

Instantly share code, notes, and snippets.

@swissspidy
Last active September 22, 2021 16:27
Show Gist options
  • Save swissspidy/f3f835f809ae20ff48883f082f49372d to your computer and use it in GitHub Desktop.
Save swissspidy/f3f835f809ae20ff48883f082f49372d to your computer and use it in GitHub Desktop.
Temporary workaround to fix duplicate canonical links when using Yoast SEO
<?php
/**
* Plugin Name: Web Stories Yoast SEO Canonical Fix
* Description: Temporary workaround to fix duplicate canonical links when using Yoast SEO
* Plugin URI: https://wp.stories.google/
* Author: Pascal Birchler, Google
* Author URI: https://opensource.google.com/
* Version: 0.0.1
* License: Apache License 2.0
* License URI: https://www.apache.org/licenses/LICENSE-2.0
*/
add_action(
'wpseo_canonical',
static function ( $canonical ) {
if ( is_singular( 'web-story' ) ) {
return false;
}
return $canonical;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment