-
Hi, I’ve tried it with the code that you shared earlier, but it added to all my posts.
My goal is to automatically add words from the tag or topic title as focus keyword for each post.
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' );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The ticket ‘Focus Keyword auto-insert problem’ is closed to new replies.