Contact Us

If your WordPress site is showing the wrong canonical URL, it can seriously damage your SEO. Google may index the wrong page, show duplicate content warnings, or even remove the correct page from rankings.

The worst part?
This issue can appear even when you don’t touch anything — because plugins, themes, redirects, or caching unexpectedly modify canonical rules.

But don’t worry.

This complete, updated 2025 guide shows you exactly how to fix wrong canonical URLs in WordPress, specifically for Yoast SEO users — with clean code snippets, real reasons, and step-by-step solutions.

Let’s fix your site.

What Is a Canonical URL and Why It Matters

A canonical URL tells Google which version of a page is the “main” version.
This helps Google avoid duplicate content and ensures SEO signals go to the right page.

For example:

https://example.com/product/shoes/

vs.

https://example.com/product/shoes/?color=red

Both pages contain the same content, but only one should be the canonical.

If WordPress shows the wrong canonical URL, you may face:

  • Ranking loss

  • Wrong pages appearing in search results

  • Parameter URLs getting indexed

  • Pagination issues

  • Duplicate content warnings in Google Search Console

  • Lower crawl efficiency

So fixing this is critical.

Why WordPress Shows the Wrong Canonical URL (Root Causes)

Before fixing it, you need to understand why it happens.

Below are the most common causes.

1. Yoast SEO Overwritten by Theme or Plugin

Some themes add their own canonical tags (bad practice).

Plugins like:

  • WooCommerce

  • FacetWP

  • WPBakery

  • Page builders

  • Pagination plugins

  • Language plugins

  • Filter plugins

…often generate their own canonical URLs.

This leads to two canonicals, and Google only accepts one.

2. Query Strings Causing Wrong Canonicals

URLs with parameters may appear:

?color=blue
?sort=asc
?ref=123

Yoast SEO removes parameters automatically — but sometimes it doesn’t.

If your site uses filters (especially WooCommerce), wrong canonicals are common.

3. Wrong Domain Version (www vs non-www)

Example:

You want:

https://www.site.com

But WordPress outputs:

https://site.com

This happens due to:

  • Incorrect WordPress Address (URL)

  • Reverse proxy rules

  • CDN rewriting

  • Bad redirect rules

4. HTTP vs HTTPS Canonical Issues

If your site is HTTPS but canonical shows HTTP, Google flags it.

Caused by:

  • Incorrect site URL

  • SSL plugins

  • Caching

  • Proxy/CDN misalignment

5. Yoast SEO Disabled Canonical With Filters

If someone added a wrong filter:

add_filter( 'wpseo_canonical', '__return_false' );

Your canonical disappears.

6. Multiple Canonicals in Header

If your theme outputs a canonical AND Yoast outputs a canonical → Google picks one randomly.

How to Fix WordPress Showing the Wrong Canonical URL (Yoast SEO Solutions)

Below is the most complete guide, step-by-step.

Step 1 — Check if Multiple Canonical Tags Exist

Open any page → Right-click → View Source → Search:

rel="canonical"

If you see more than one, you must remove the extra one.

Fix: Remove Canonical from Theme

Open header.php and search:

canonical

If found, delete it.

Yoast SEO must handle all canonicals.

Step 2 — Ensure Yoast SEO Adds the Correct Canonical

Go to:

SEO → Search Appearance → General

Make sure:

  • Homepage canonical is correct

  • Taxonomies & archives are enabled correctly

Step 3 — Force Correct Canonical URL Using Yoast SEO Filter

If Yoast is still generating the wrong URL, override it using a filter.

Fix: Add Custom Canonical for a Specific Page

add_filter( 'wpseo_canonical', function( $canonical ) {
if ( is_page( 123 ) ) {
return 'https://example.com/my-correct-page/';
}
return $canonical;
});

Step 4 — Remove Query Strings from Canonical URL

If canonical contains parameters (?filter=something), use this:

add_filter( 'wpseo_canonical', function( $canonical ) {
return strtok( $canonical, '?' );
});

This forces Yoast to remove all parameters.

Step 5 — Fix Canonical for WooCommerce Product Filters

If your product filter URLs look like:

?color=red
?size=small

Use this WooCommerce-specific canonical fix:

add_filter( 'wpseo_canonical', function( $canonical ) {
if ( is_shop() || is_product_category() ) {
return remove_query_arg( array( 'filter', 'size', 'color', 'sort' ), $canonical );
}
return $canonical;
});

Step 6 — Fix HTTP vs HTTPS Canonical Problems

If canonical shows http:// instead of https://:

Fix WordPress Settings

Go to:

Settings → General

Set both to HTTPS:

  • WordPress Address (URL)

  • Site Address (URL)

Step 7 — Fix www / non-www Canonical Issues

Use the correct preferred domain.

If you want non-www:

https://example.com

Force it using:

add_filter( 'wpseo_canonical', function( $canonical ) {
return str_replace( 'www.', '', $canonical );
});

Or enforce www:

add_filter( 'wpseo_canonical', function( $canonical ) {
return str_replace( 'https://example.com', 'https://www.example.com', $canonical );
});

Step 8 — Fix Canonical on Pagination Pages

Yoast sometimes outputs:

https://example.com/blog/

Instead of:

https://example.com/blog/page/2/

Fix:

add_filter( 'wpseo_canonical', function( $canonical ) {
if ( is_paged() ) {
global $wp;
return home_url( add_query_arg( [], $wp->request ) );
}
return $canonical;
});

Step 9 — Remove Duplicate Canonical Created by Plugins

If another plugin prints canonical tags, disable them.

Known plugins:

  • RankMath (if installed and half-active)

  • WooCommerce Multilingual

  • WPBakery

  • SEO Framework remnants

Disable duplicate canonicals:

remove_action( 'wp_head', 'pluginname_add_canonical' );

Replace pluginname_add_canonical with the function name found in the theme/plugin.

Step 10 — Clear Cache, CDN, Server Cache, and Regenerate

Canonical issues often persist because of cache layers.

Clear:

  • Browser cache

  • WordPress cache (WP Super Cache, WP Rocket, etc.)

  • CDN cache (Cloudflare)

  • Hosting cache (LiteSpeed, NGINX FastCGI)

Then test again.

Advanced Fixes (When Nothing Else Works)

Sometimes your canonical breaks due to very deep issues.

Below are advanced fixes.

A. Fix Canonical for Custom Post Types

add_filter( 'wpseo_canonical', function( $canonical ) {
if ( is_singular( 'portfolio' ) ) {
return get_permalink();
}
return $canonical;
});

B. Fix Canonical for Pagination of Custom Post Types

add_filter( 'wpseo_canonical', function( $canonical ) {
if ( is_post_type_archive( 'portfolio' ) && is_paged() ) {
return trailingslashit( get_post_type_archive_link( 'portfolio' ) ) . 'page/' . get_query_var( 'paged' ) . '/';
}
return $canonical;
});

C. Fix Canonical for Category Pages with Sorting

add_filter( 'wpseo_canonical', function( $canonical ) {
if ( is_category() ) {
return remove_query_arg( array( 'orderby', 'order' ), $canonical );
}
return $canonical;
});

Bonus: How to Check Canonicals the Pro Way (Not Guesswork)

Use these tools:

View Source

Check rel="canonical".

Google Search Console → URL Inspection

This shows the actual canonical Google picked.

Screaming Frog SEO Spider

Crawl → Canonical column.

Ahrefs / Semrush Site Audit

Cloudflare Cache Bypass Check

Sometimes the wrong canonical is cached at edge level.

Final Checklist: WordPress Wrong Canonical Fix

Before finishing, confirm:

Task Status
Only 1 canonical tag printed
Yoast allowed to control canonicals
Fixed parameters
HTTPS enforced
Correct domain version
WooCommerce filters fixed
Duplicate plugin canonicals removed
Cache purged
Tested in URL inspection

Once this checklist is green, your canonical issue is permanently fixed.

FAQs

1. Why is Yoast showing the wrong canonical URL?

Because another theme or plugin overrides Yoast’s canonical, or query parameters are modifying the URL.

2. How do I remove query strings from canonical URLs?

Use this filter:

add_filter( 'wpseo_canonical', function( $canonical ) {
return strtok( $canonical, '?' );
});

3. Can I set a custom canonical URL in Yoast?

Yes — edit any post → Yoast SEO → Advanced → Canonical URL.

4. Why does my canonical show HTTP not HTTPS?

Because your WordPress Address URL is not updated to HTTPS.

5. Does having multiple canonical tags hurt SEO?

Yes. Google may index the wrong page or ignore your canonical completely.

6. How long does Google take to update canonical changes?

Usually 48–72 hours after re-crawling.

7. Should WooCommerce filter pages have canonical?

No — they should canonical to the main category or product page.

Subscribe To Our Newsletter & Get Latest Updates.

Copyright @ 2025 WPThrill.com. All Rights Reserved.