---
title: "Bulk Update Canonical URLs in WordPress from a Spreadsheet"
url: "https://wpimportexport.com/bulk-update-canonical-urls-wordpress-csv/"
description: "Set Yoast or Rank Math canonical URLs for many posts at once: export the posts, fill the URLs in a spreadsheet and import them back by ID."
type: post
published: 2026-11-28T11:00:00+00:00
modified: 2026-11-25T18:43:05+00:00
categories: ["Export Guides", "Tutorials"]
tags: ["CSV Export", "Import Export by RockStarLab", "SEO Audit"]
docs_topics: ["Bulk updates and automation", "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)](https://wpimportexport.com/wp-content/uploads/2026/11/canonical-fields-1024x504.webp)

_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](https://wpimportexport.com/wp-content/uploads/2026/11/canonical-import-mapping-1024x246.webp)

_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](https://wpimportexport.com/wp-content/uploads/2026/11/canonical-import-options-1024x319.webp)

_Update existing posts by ID only._

Both posts were updated:

![Import finished: 2 successful, 2 updated, 0 created, 0 skipped, 0 failed](https://wpimportexport.com/wp-content/uploads/2026/11/canonical-import-done-1024x621.webp)

_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](https://wpimportexport.com/wp-content/uploads/2026/11/canonical-yoast.webp)

_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](https://wpimportexport.com/syndicate-wordpress-posts-multiple-sites/).

Before importing, [back up the site](https://wpimportexport.com/how-to-create-a-wordpress-website-backup-and-restore-it/), 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](https://wpimportexport.com/connect-claude-code-to-wordpress-mcp/)). 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.

## Related Guides

- [Syndicate Blog Posts from One WordPress Site to Several Sites](https://wpimportexport.com/syndicate-wordpress-posts-multiple-sites/)
- [How to Bulk Update Yoast SEO Titles and Meta Descriptions from CSV](https://wpimportexport.com/bulk-update-yoast-meta-descriptions-csv/)
- [Find All Noindex Posts in Yoast SEO and Review Them in a Spreadsheet](https://wpimportexport.com/yoast-noindex-posts-export-review/)
- [How to Export All Site URLs to CSV or Excel in WordPress](https://wpimportexport.com/how-to-export-all-site-urls-to-csv-or-excel-in-wordpress/)

Get the free plugin on [WordPress.org](https://wordpress.org/plugins/import-export-by-rockstarlab/).
