-
Hi Rankmath,
Is it possible to choose a specific CPT and use the following code:
/**
* 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’);Cause I only want it applied to all titles in a specific CPT
Best regards
Jacob
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
The ticket ‘CPT title bulk focus keyword’ is closed to new replies.