Hello,
Thank you for contacting Rank Math today.
Unfortunately there is no current feature in Rank math automate keywords for already existing posts. You can use the following snippet that was used to auto-fill the keyword using tags. With the help of a developer, you can customize it to fit your situation.
function update_focus_keywords() {
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'post' //replace post with the name of your post type
));
foreach($posts as $p){
if(get_the_tags($p->ID)){
foreach((get_the_tags($p->ID)) as $tag) {
$keywords[] = strtolower($tag->name);
}
update_post_meta($p->ID,'rank_math_focus_keyword',implode(", ", array_unique($keywords)));
}
}
}
add_action( 'init', 'update_focus_keywords' );
Hope it helps you. Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.