The built-in migration tool also supports Rank Math. It reads data directly from the database.
What Gets Migrated
| Rank Math Meta Key | SEO Forge Meta Key |
|---|---|
rank_math_title | _seoforge_meta_title |
rank_math_description | _seoforge_meta_description |
rank_math_focus_keyword | _seoforge_focus_keyword |
rank_math_robots (noindex) | _seoforge_noindex |
rank_math_robots (nofollow) | _seoforge_nofollow |
rank_math_canonical_url | _seoforge_canonical_url |
rank_math_facebook_title | _seoforge_og_title |
rank_math_facebook_description | _seoforge_og_description |
rank_math_facebook_image | _seoforge_og_image |
rank_math_twitter_title | _seoforge_twitter_title |
rank_math_twitter_description | _seoforge_twitter_description |
Custom Rank Math canonical URLs (rank_math_canonical_url) are imported into _seoforge_canonical_url.
Manual Rank Math Migration
php
global $wpdb;
// Migrate Rank Math descriptions
$rm_meta = $wpdb->get_results(
"SELECT post_id, meta_value FROM {$wpdb->postmeta}
WHERE meta_key = 'rank_math_description' AND meta_value != ''"
);
foreach ( $rm_meta as $row ) {
$existing = get_post_meta( $row->post_id, '_seoforge_meta_description', true );
if ( empty( $existing ) ) {
// Resolve Rank Math variables: %title%, %sitename%, %sep%
$desc = 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_description', sanitize_text_field( $desc ) );
}
}
// Migrate Rank Math robots meta
$robots_meta = $wpdb->get_results(
"SELECT post_id, meta_value FROM {$wpdb->postmeta}
WHERE meta_key = 'rank_math_robots'"
);
foreach ( $robots_meta as $row ) {
$robots = maybe_unserialize( $row->meta_value );
if ( is_array( $robots ) ) {
if ( in_array( 'noindex', $robots, true ) ) {
update_post_meta( $row->post_id, '_seoforge_noindex', '1' );
}
if ( in_array( 'nofollow', $robots, true ) ) {
update_post_meta( $row->post_id, '_seoforge_nofollow', '1' );
}
}
}—