A PHP-based WordPress utility for exporting, comparing, and selectively migrating Yoast SEO metadata from an existing website to a new WordPress installation.
Designed primarily for Elementor-to-Bricks Builder migrations, this tool helps identify missing or mismatched SEO metadata before a redesigned website goes live.
The utility consists of two separate snippets:
- Source Site Exporter — exports page information, SEO metadata, and extracted content from the original WordPress website into a JSON file.
- Staging Site Comparator & Importer — imports the JSON file, matches pages against the staging website, displays differences in an admin dashboard, and allows administrators to selectively update approved SEO fields.
The workflow is designed around reviewing differences before making changes rather than blindly importing metadata.
The source-site snippet generates a downloadable JSON export containing page information and SEO metadata.
Depending on the exporter configuration, the export includes:
- WordPress post type
- Page slug and URL path
- Parent page path
- Page title and publication status
- Excerpt and page template
- Featured image filename
- Extracted text from Elementor data and WordPress content
- Yoast SEO title
- Yoast meta description
- Yoast focus keyphrase
The exporter is intended to be read-only. It does not modify the source pages or their SEO metadata.
The staging comparator matches exported records with pages on the destination website using:
- Post type
- URL path, including the parent-page hierarchy where available
This is more reliable than matching pages by title alone, since titles can change during a redesign.
The dashboard identifies pages that match, pages with SEO differences, pages with content differences, and pages that are missing or ambiguous.
Important: Matching depends on consistent URL paths. If the destination website has different slugs or page hierarchies, those pages may require manual review.
The importer focuses on these three Yoast SEO fields:
| Field | WordPress meta key | Purpose |
|---|---|---|
| SEO title | _yoast_wpseo_title |
Search result title |
| Meta description | _yoast_wpseo_metadesc |
Search result description |
| Focus keyphrase | _yoast_wpseo_focuskw |
Keyphrase used by Yoast's SEO analysis |
The dashboard displays the source and staging values so that administrators can review differences before updating the destination website.
Other page information is used for comparison and context. The tool is not intended to migrate page layouts or replace the destination page content.
The tool extracts and compares text from available page content and builder data to help identify pages that may have changed during migration.
This is useful for checking whether the source page and its replacement contain broadly similar text.
Content comparison is approximate. Differences in builder storage, shortcodes, dynamic content, formatting, widgets, and generated markup can affect the result. A content difference does not necessarily indicate a problem.
The staging dashboard allows administrators to:
- Search and filter comparison results
- Review SEO differences
- Inspect source and destination values
- Select individual matched pages
- Select visible matched pages in bulk
- Confirm the intended update before proceeding
Only selected pages are processed. This helps avoid overwriting metadata across the entire website unintentionally.
Before changing a page's SEO metadata, the importer stores the previous values of the three supported Yoast fields in the page's _ysmcp_previous_yoast_metadata post meta.
This provides a record of the previous values for recovery or manual restoration.
Backup limitation: The current implementation stores a previous-value snapshot rather than providing a complete backup-management or one-click rollback interface. Repeated updates may replace the previous snapshot. Keep a separate database backup before running bulk changes.
Empty source SEO values are not intended to erase existing destination metadata.
This is important because an empty field on the source website may be intentional, unavailable, or not configured. The migration process should not automatically interpret an empty value as an instruction to delete a destination value.
The staging comparator provides an interface under:
WordPress Admin → Tools → SEO Migration Comparator
The dashboard includes comparison summaries, filtering, search, per-page details, selection controls, and a confirmation step before updates.
The source exporter is available under:
WordPress Admin → Tools → Yoast Migration Export
Exact menu labels may vary if the snippets have been customized.
- WordPress installation on both the source and destination websites
- Yoast SEO installed on the relevant websites
- Code Snippets plugin, or an equivalent method for safely managing PHP snippets
- Permission to manage the relevant WordPress pages and metadata
- A database backup of the destination website before importing
- Access to the source-site JSON export
The snippets should be reviewed against the current WordPress, Yoast SEO, and PHP versions before production use.
- Open the WordPress admin dashboard of the original website.
- Install or open the Code Snippets plugin.
- Create a new PHP snippet.
- Paste the Source Site Exporter code.
- Save and activate it on the source website only.
- Open Tools → Yoast Migration Export.
- Generate and download the JSON export.
The export file contains website content and SEO metadata. Store it securely and do not publish it publicly if it includes confidential information.
- Open the WordPress admin dashboard of the destination staging website.
- Create a new PHP snippet in Code Snippets.
- Paste the SEO Migration Comparator & Importer code.
- Save and activate it on the staging website only.
- Confirm that the staging protection checks recognize the destination as a staging environment.
- Open Tools → SEO Migration Comparator.
Do not activate the importer on the live production website.
The comparator includes a staging-environment check. Its behavior depends on the WordPress environment configuration and recognized staging hostnames.
Where appropriate, configure the staging website's wp-config.php with:
define( 'WP_ENVIRONMENT_TYPE', 'staging' );If the constant is already defined, edit the existing definition rather than adding a duplicate.
The environment check is a precaution, not a complete security boundary. Verify that it correctly identifies your staging website before enabling any update workflow.
- Open the comparator dashboard on staging.
- Upload the JSON file generated by the source exporter.
- Allow the tool to validate and process the export.
- Review the summary and comparison results.
- Investigate missing or ambiguous page matches before making changes.
- Filter for SEO differences.
- Inspect the source and destination SEO values for each relevant page.
- Check content differences when they may indicate that the wrong pages were matched or that content was missed during migration.
- Select only the pages you want to update.
- Review the confirmation prompt.
- Confirm the update.
Afterward, review the affected pages in WordPress and verify their SEO fields in Yoast.
- Back up the destination database.
- Complete the page migration and confirm the intended destination slugs.
- Export the source site's metadata.
- Upload the export to the staging comparator.
- Review missing and ambiguous matches first.
- Review SEO title, meta description, and focus keyphrase differences.
- Review significant content differences.
- Update only the approved pages.
- Check the resulting metadata in the WordPress editor.
- Test important URLs and SEO output before deploying staging to production.
This tool is designed for page-level metadata comparison and selective migration. It should not be treated as a complete website migration solution.
- Supported SEO updates: Yoast SEO title, meta description, and focus keyphrase.
- Page matching: Based on post type and URL path; changed slugs and parent paths can prevent automatic matching.
- Content comparison: Approximate text comparison, not a visual layout or full HTML comparison.
- Builder support: Extracted content depends on what is available in WordPress content and builder metadata. Elementor and Bricks may store data differently.
- Post types: The current implementation focuses on WordPress pages. Posts and custom post types may need additional configuration.
- Other SEO metadata: Canonical URLs, robots directives, social metadata, schema settings, redirects, breadcrumbs, and other SEO fields are not automatically migrated by the three-field update process.
- Page layouts: The importer does not migrate Elementor layouts to Bricks layouts.
- Rollback: Previous metadata is stored, but a dedicated rollback interface is not included.
- Production safety: The staging guard reduces accidental use but does not replace a backup, code review, and testing.
- Run the importer only on a controlled staging website.
- Keep WordPress and its plugins updated.
- Restrict access to trusted administrators.
- Use the provided capability checks and nonce verification.
- Do not share exported JSON files publicly.
- Review imported data before applying changes.
- Back up the database before bulk updates.
- Inspect the code before installing it on a site that contains sensitive content.
Before relying on the tool for a large migration, test it with a small selection of pages.
- The source exporter runs without changing source data.
- The JSON export downloads and contains the expected pages.
- Pages with matching paths are matched correctly.
- Pages with changed paths are flagged for review.
- SEO title differences appear correctly.
- Meta description differences appear correctly.
- Focus keyphrase differences appear correctly.
- Empty source fields do not clear destination metadata.
- Content differences are displayed as expected.
- Unselected pages remain unchanged.
- Selected pages update only the three supported fields.
- Previous metadata is backed up before changes.
- The confirmation step works as intended.
- The importer refuses to run when the staging safety check fails.
- The updated pages are reviewed in Yoast and on the front end.
Pages appear as missing
Check whether the source and destination use the same slug, post type, and parent-page path. Review the JSON export to confirm that the expected source record exists.
Multiple pages are ambiguous
Duplicate paths or multiple records that resolve to the same matching key need manual investigation. Avoid applying updates until the matching issue is resolved.
SEO values appear empty
Confirm that the source pages have the expected Yoast metadata and that the export includes the correct meta keys. Empty source values are not meant to clear destination values.
Content comparison reports differences
Builder data can contain different formatting, shortcodes, dynamic elements, or generated content. Inspect the actual page content before deciding whether the difference is significant.
The importer refuses to run on staging
Check WP_ENVIRONMENT_TYPE, the staging hostname, and the snippet's environment guard. Do not bypass the protection without understanding why the environment was not recognized.
An update does not appear on the front end
Verify the metadata in the WordPress editor, then clear relevant page, server, and CDN caches. Confirm that Yoast is generating the expected output and that no other plugin or theme code overrides it.
This utility is provided as a migration aid. Review the code, test on staging, and keep a database backup before applying updates. No automatic matcher or content comparison can guarantee that every page is mapped correctly.
Use it as a review-first workflow to help reduce manual effort and migration errors, not as a substitute for final SEO validation.