• I am using Yoast for years. Over the years, sometimes I changed the URL structure of posts, changed category names, etc. I did proper 301 redirects.

    Yesterday while browsing Ahrefs, I noticed that there were Canonical URLs on my site which all point to the first version of the URL of the corresponding post.

    https://www.domain.com/category/url 1st version when I first published the post

    https://www.domain.com/category/newurl latest version of the URL

    In Yoast settings, the canonical URL is https://www.domain.com/category/url (first version) at almost all posts.

    I don’t have an idea how that happened and how I never noticed. (I never use Canonical URLs perhaps that’s why)

    1st question: I’d like to remove the canonical URL feature altogether from my website. How do I do that? I am sure there are tons of other people who are not yet aware of this situation. Maybe you should put this option in the settings.

    2nd question: If 1st question isn’t possible, how do I bulk delete Yoast generated canonical URLs? (I have 3000+ posts)

    ps: if you claim that these canonical URLs are not generated by Yoast, please explain how they are kept and how we avoid this in the future. This is a very important issue in my opinion. My cornerstone contents point to old URLs, this is a disaster in terms of SEO.

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support devnihil

    (@devnihil)

    @belgen We’re sorry to hear you are experiencing this issue on your site. We’ve addressed your concern below:

    I’d like to remove the canonical URL feature altogether from my website. How do I do that? I am sure there are tons of other people who are not yet aware of this situation. Maybe you should put this option in the settings.

    You can remove the canonical URL from being output by using the wpseo_canonical developer filter. You can use the following code example and add this to your site’s functions.php file in order to implement it:

    add_filter( 'wpseo_canonical', '__return_false' );

    We also have additional code examples of using the wpseo_canonical developer filter available here.

    Thread Starter Cagatay Belgen

    (@belgen)

    Thanks for the reply.

    add_filter( 'wpseo_canonical', '__return_false' );

    does it actually delete the canonical URLs from the database or it does just avoid the canonical URLs getting written in HTML code produced by PHP?

    Plugin Support devnihil

    (@devnihil)

    @belgen Thanks for your reply.

    The wpseo_canonical filter would not affect any values in the database, it only removes the canonical URL from being output.

    We also have more documentation on managing canonical URLs in Yoast SEO available at our developer portal at the following URL: https://developer.yoast.com/features/seo-tags/canonical-urls/overview/

    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing Yoast Generated Canonical URLs’ is closed to new replies.