-
Hello,
I am currently using the following function to automatically populate the focus Keyword field.
/**
* Function to automatically update the focus keyword with the post title
*/
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) {
update_post_meta($p->ID, 'rank_math_focus_keyword', strtolower(get_the_title($p->ID)));
}
}
add_action('init', 'update_focus_keywords');However, if I edit any focus kewyrod manually, I cannot save the change.
I turn to the excellent developers at Rank Math….
Is there a way that if the focus keyword field is filled in that the function does not continue to automatically put the title of the post or page?
Regards
The ticket ‘Exclude keyword in function “auto add focus keyword”’ is closed to new replies.