Created
June 7, 2023 12:53
-
-
Save yxod/c8eb58e9d0ee4b5a88db008dc92640f2 to your computer and use it in GitHub Desktop.
add canonical paged category
This file contains 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 canonical category paged | |
function yoast_seo_canonical_change_woocom_shop($canonical) | |
{ | |
if (is_paged() && is_category()) { | |
$category = get_queried_object(); | |
$category_link = get_category_link($category); | |
$canonical = esc_url($category_link); | |
} | |
return $canonical; | |
} | |
add_filter('wpseo_canonical', 'yoast_seo_canonical_change_woocom_shop', 10, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment