Created
August 12, 2020 10:38
-
-
Save vivirenremoto/4cc80a47eb3d35c0bafa44982d431d98 to your computer and use it in GitHub Desktop.
yost set canonical url only posts
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
/* seo canonical problem */ | |
function yoast_seo_canonical_change_post( $canonical ) { | |
if ( !is_single() ) { | |
return $canonical; | |
} | |
global $post; | |
return get_permalink($post); | |
} | |
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_post', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment