Created
April 3, 2023 15:42
-
-
Save kbcarte/32e1de04e0824390b268606f376ef5c6 to your computer and use it in GitHub Desktop.
Remove the trailing slash from the canonical meta link form Yoast SEO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Place in functions.php */ | |
function prefix_filter_canonical_example( $canonical ) { | |
if ( substr( $canonical, -1 ) == "/" ) { | |
return substr($canonical, 0, -1); | |
} | |
return $canonical; | |
} | |
add_filter( 'wpseo_canonical', 'prefix_filter_canonical_example' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment