Hello @jaworowicz
Please take a complete backup before running the following query:
$posts = get_posts( array(
'posts_per_page' => 100,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'rank_math_description',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'rank_math_description',
'value' => '',
'compare' => '='
),
)
)
);
foreach( $posts as $post ) {
$description = get_post_meta( $post->ID, 'my_post_desc_meta', true );
update_post_meta( $post->ID, 'rank_math_description', $description );
}
You can use this in init hook or wp hook. You will have to run this multiple times as posts_per_page only gets first 100 posts.
Hope that helps. Thank you.