-
From https://rankmath.com/kb/how-to-automate-the-insertion-of-focus-keyword/
Automatically Use the Post Title as the Focus Keyword
/** * 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');Is it possible to insert word “Buy” in front of every Focus Keyword? Basically right now it would use title of the product, I assume this code will work for products too? So if the product is called “Nike Shoes” then Focus Keyword would be “Nike Shoes”. I am wondering if it’s possible to add to this automatization “Buy %Title%” so “Buy Nike Shoes”. (I know %title% doesn’t work for focus keyword, just an example)
Thank you!
The ticket ‘Can you add “Buy” in front of %title% in focus keyword? (with Functions code)’ is closed to new replies.