Last active
October 1, 2019 10:11
-
-
Save RiodeJaneiroo/c113268446c626a4b4a4a7f39569c548 to your computer and use it in GitHub Desktop.
[Wordpress Yoast remove page in canonical] #seo #yoasy #wordpress
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
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_home_url_slash' ); | |
function yoast_seo_canonical_change_home_url_slash( $canonical_url ) { | |
$re = '/\/page\/\d+\//m'; | |
$str = $canonical_url; | |
$subst = '/'; | |
$result = preg_replace($re, $subst, $str); | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment