Customized canonical link | WordPress.org

[ad_1]

Hey @gregouille,

Thank you for using Yoast SEO and for reaching out!

While we can’t review or give support on custom code – please know that I just tested the first code example from https://developer.yoast.com/features/seo-tags/canonical-urls/api/ and can confirm that that still works. Just enter the page ID in the if statement and return the URL you want.

Good luck.

  • This reply was modified 1 hour, 1 minute ago by Jeroen Rotty. Reason: typo

Hi @jeroenrotty,

Thank you for your quick answer.

I am using exactly the function you just sent me which is still without success. The only thing I want to do is to add the URL parameters in the canonical link.

Example: ->

Is the condition for the page ID important? Because I still have a lot of pages that need to be assigned…

Hey @gregouille,

I tested the same snippet with an URL that included a URL parameter (?pagination=2), see:

If that is not working on your instance, please check with a default theme or with only Yoast SEO active, maybe there is another plugin or other custom code interefering. As I previously said, please understand that we can’t give support on customization/custom code.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer