Back to blog
5 min read Export Guides

Bulk Update Canonical URLs in WordPress from a Spreadsheet

A canonical URL tells search engines which address is the original version of a page. You need one when the same article is published on two sites, when a post was copied from another blog with permission, or when several posts cover the same product and one of them should rank. Yoast SEO and Rank Math have a canonical field in each post, but filling it post by post is slow once there are dozens of copies. With Import Export by RockStarLab, you export the posts, put the canonical URLs into a spreadsheet and import them back in one run.

Free: export and import of posts with SEO fields are in the free plugin. The test below used Import Export by RockStarLab 2.2.13 and Yoast SEO 28.8.

Short Answer

Yoast stores the canonical URL of a post in the custom field _yoast_wpseo_canonical; Rank Math uses rank_math_canonical_url. Export the posts with ID, Title, Slug, Permalink and the Canonical URL column. Fill the canonical column with the URL of the original page, keep only ID, Title and the canonical column, and import the file with Check for Existing Items by Field set to ID, Update for matches and Skip for rows that don’t match.

Export the posts that need a canonical URL

In our test, three posts had been copied from a main site to a second site. Two of them should point to the originals on the main site; the third should keep its own URL.

On the second site, in the plugin’s Export, we chose Blog Posts and filtered by the three categories the copies were in. On the Fields step we dragged in ID, Title, Slug and Permalink from Standard and Canonical URL from the Yoast SEO group:

Export Step 3 with five columns: ID, Title, Slug, Permalink and Canonical URL (_yoast_wpseo_canonical)
Export the posts with the Yoast Canonical URL column.

The CSV had an empty canonical column, because none of the posts had a canonical URL yet. An empty value means Yoast uses the post’s own permalink.

Fill the canonical URLs in the spreadsheet

For each copy, put the full URL of the original post into _yoast_wpseo_canonical. When the originals are on another WordPress site, export Slug and Permalink there too and look up the URL by slug with VLOOKUP or XLOOKUP; in our case the slugs were the same on both sites.

Then delete the rows that keep their own URL and every column except ID, post_title and _yoast_wpseo_canonical. The file we imported:

ID post_title _yoast_wpseo_canonical
7321 Ethiopia Guji Natural: Brewing Notes http://aie6.local:10096/2026/11/13/ethiopia-guji-natural-brewing-notes/
7319 Kenya AA Roast Profile http://aie6.local:10096/2026/11/13/kenya-aa-roast-profile/

The URLs point to our test copy of the main site; on a live site they are your original post URLs, with https://.

Import the canonical URLs

In Import, we chose Blog Posts, uploaded the file and clicked Auto Map. The three columns were mapped to the fields with the same names:

Import Mapped Fields: ID, post_title and _yoast_wpseo_canonical
Three columns mapped by Auto Map.

On the Options step we set Check for Existing Items by Field to ID, kept Update for matches and chose Skip when no match is found, so a wrong ID can’t create a new post:

Import Step 5 with Check for Existing Items by ID, If Match Found Update and If No Match Found Skip
Update existing posts by ID only.

Both posts were updated:

Import finished: 2 successful, 2 updated, 0 created, 0 skipped, 0 failed
Both posts updated.

In the Yoast SEO box of Ethiopia Guji Natural: Brewing Notes, under Advanced, the Canonical URL field showed the original post’s address:

Yoast SEO Advanced section with the Canonical URL field set to the original post URL
The canonical URL in the Yoast SEO box after the import.

The third post, which wasn’t in the file, kept an empty canonical field and still points to itself.

Things to know

  • To remove a canonical URL, leave its cell empty and import the file the same way; the post goes back to its own permalink.
  • Yoast doesn’t output a canonical tag on pages set to noindex, so check the tag on an indexed page. In the page source, look for <link rel="canonical".
  • Rank Math works the same way with the column rank_math_canonical_url.
  • For pages and custom post types, choose them in step 1 of the export and the import; the field name is the same.
  • If the copies were made with Content Sync, a later push from the main site replaces the canonical URL with the main site’s value. Import the canonical file again after the last push, as described in syndicating blog posts to several sites.

Before importing, back up the site, or ask your AI agent to start the backup.

With an AI agent

Import Export by RockStarLab gives AI agents its exports, imports and Content Sync as abilities. Through the WordPress MCP Adapter, WordPress itself offers an agent only read-only abilities for site, user and environment information, so without the plugin the agent cannot do the steps above (to connect an agent, see connecting Claude Code to WordPress). With it, one request is enough:

With Import Export by RockStarLab, which posts have a Yoast canonical URL, and where do they point?

In our run, the agent called rsl-ie/export-preview for posts with a meta_query on _yoast_wpseo_canonical not empty and the fields ID, title and canonical URL. It returned the two posts from the file, each pointing to its original on the main site.

FAQ

How do I bulk change canonical URLs in WordPress?

Export the posts with ID and the SEO plugin’s canonical column, fill in the URLs in a spreadsheet, and import the file with matching by ID and Update.

Where does Yoast SEO store the canonical URL?

In the post’s custom field _yoast_wpseo_canonical. Rank Math uses rank_math_canonical_url.

Should a copied post have a canonical URL?

If the copy repeats the original without changes and the original should rank, point the copy’s canonical URL to the original. A rewritten or translated post can keep its own URL.

How do I remove a canonical URL from many posts?

Leave the canonical cell empty for those posts and import the file with matching by ID and Update.

Get the free plugin on WordPress.org.

Dmitriy
About author

Dmitriy

WordPress Developer with 15+ years of commercial experience. Elite Author on ThemeForest and creator of custom WordPress plugins. Passionate about clean code, performance optimization, and building useful tools for the WordPress community.

JOIN THE CONVERSATION

Comments 0

Have a question or a tip to share? Leave it below.

Leave a comment

Your email address will not be published. Required fields are marked *

We store your name, email and comment to show and moderate it; your email is never published. Spam protection is provided by Cloudflare Turnstile and profile pictures by Gravatar. See our Privacy Policy.


Try the plugin with no risks!

New users get 1 month with access to all premium features. Experience the most powerful WordPress data engine today.

Download Now
Get PRO for FREE