46. Migration from Yoast | SEO Forge - Rank Higher with AI-Powered SEO
Download Log in

46. Migration from Yoast

Developer Guide

SEO Forge includes a built-in migration tool accessible at SEO Forge > Migration in the admin menu. It reads Yoast data directly from the database without requiring Yoast to be active.

What Gets Migrated

Yoast Meta KeySEO Forge Meta Key
_yoast_wpseo_title_seoforge_meta_title
_yoast_wpseo_metadesc_seoforge_meta_description
_yoast_wpseo_focuskw_seoforge_focus_keyword
_yoast_wpseo_meta-robots-noindex_seoforge_noindex
_yoast_wpseo_meta-robots-nofollow_seoforge_nofollow
_yoast_wpseo_canonical_seoforge_canonical_url
_yoast_wpseo_opengraph-title_seoforge_og_title
_yoast_wpseo_opengraph-description_seoforge_og_description
_yoast_wpseo_opengraph-image_seoforge_og_image
_yoast_wpseo_twitter-title_seoforge_twitter_title
_yoast_wpseo_twitter-description_seoforge_twitter_description

Custom Yoast canonical URLs (_yoast_wpseo_canonical) are imported into _seoforge_canonical_url. Empty or invalid values are ignored; valid values are emitted as the post’s only .

Programmatic Migration

php
// Trigger migration programmatically (same as the admin UI)
if ( class_exists( 'SEOFORGE_Migration' ) ) {
    $migration = SEOFORGE_Migration::instance();
    // The migration is triggered via AJAX in the admin UI
    // For programmatic use, call the internal methods
}

Manual Migration via SQL

php
// Migrate Yoast titles to SEO Forge (if Migration tool is unavailable)
global $wpdb;

$yoast_meta = $wpdb->get_results(
    "SELECT post_id, meta_value FROM {$wpdb->postmeta}
     WHERE meta_key = '_yoast_wpseo_title' AND meta_value != ''"
);

foreach ( $yoast_meta as $row ) {
    $existing = get_post_meta( $row->post_id, '_seoforge_meta_title', true );
    if ( empty( $existing ) ) {
        // Resolve Yoast variables: %%title%%, %%sitename%%, %%sep%%
        $title = str_replace(
            [ '%%title%%', '%%sitename%%', '%%sep%%' ],
            [ get_the_title( $row->post_id ), get_bloginfo( 'name' ), '|' ],
            $row->meta_value
        );
        update_post_meta( $row->post_id, '_seoforge_meta_title', sanitize_text_field( $title ) );
    }
}

Post-Migration Verification

php
// After migration, re-analyze all posts to update scores
$post_ids = get_posts( [
    'post_type' => [ 'post', 'page' ], 'post_status' => 'publish',
    'posts_per_page' => -1, 'fields' => 'ids',
] );

$analyzer = SEOFORGE_Analyzer::instance();
foreach ( $post_ids as $pid ) {
    $analyzer->analyze( $pid );
}

Forge AI Assistant Online

Hi! I'm the SEO Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs