You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened
I have pages where I need to override the canonical - if I have a URL without any periods whatsoever, everything works fine, but if my URL includes a period, the final slash in the URL gets removed for some reason
function yubicool_wwyk_canonical($canonical) {
$canonical = home_url('/works-with-yubikey/catalog/relate.it/');
echo $canonical; // This prints https://www.yubico.com/works-with-yubikey/catalog/relate.it/
return $canonical; // The canonical is set to https://www.yubico.com/works-with-yubikey/catalog/relate.it <- No trailing slash
}
add_filter('wpseo_canonical', 'yubicool_wwyk_canonical');
Check the canonical URL of the page
Expected results
The echoed URL is equivalent to the canonical URL
Actual results
The canonical URL is missing a trailing slash
Screenshots, screen recording, code snippet
If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.
Technical info
If relevant, which editor is affected (or editors):
Block Editor
Gutenberg Editor
Elementor Editor
Classic Editor
Other:
Which browser is affected (or browsers):
Chrome
Firefox
Safari
Other:
Used versions
Device you are using: (docker) ubuntu:focal
Operating system: ubuntu:focal
PHP version: 7.4
WordPress version: 7.4
WordPress Theme: 5.6.3
Yoast SEO version: 22.6
Relevant plugins in case of a bug:
The text was updated successfully, but these errors were encountered:
Thanks for using the Yoast SEO plugin and also for creating the issue. I tried to reproduce the issue by creating a URL with a period within the slug. Unfortunately, I noticed that WordPress is changing the period to - hypen automatically. So, is there any way to replicate this, as WordPress seems to be not allowing the period in the slug by default?
Please give us a description of what happened
I have pages where I need to override the canonical - if I have a URL without any periods whatsoever, everything works fine, but if my URL includes a period, the final slash in the URL gets removed for some reason
To Reproduce
Step-by-step reproduction instructions
Add a filter like so (assuming the site is https://www.yubico.com)
Expected results
Actual results
Screenshots, screen recording, code snippet
If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.
Technical info
Used versions
The text was updated successfully, but these errors were encountered: