Rank math auto keywords
-
Hello, I just switched to Rank math and I like your plugin. However, until I installed rank math, there were so many pages that I couldn’t deal with keywords. That’s why I need keywords to be added automatically. For example: automatically define the page title as a keyword for individual product pages. The other need is for product categories pages. Automatically add the title of the product category as a keyword. In other words, titles are automatically added as keywords for both page types.
I found a code in this direction.
function update_product_focus_keywords()
{
$products = get_posts(array(
‘posts_per_page’ => 100,
‘post_type’ => ‘product’ //replace post with the name of your post type
));
foreach ($products as $p) {
update_post_meta($p->ID, ‘rank_math_focus_keyword’, strtolower(get_the_title($p->ID)));
}
}
add_action(‘init’, ‘update_product_focus_keywords’);This code works but limits it to 100 products. The limit is -1, and when I do it I get a 500 error message.
I would like to use your artificial intelligence tool, but I will not be able to use it because it does not have Turkish support. I’m waiting for your help. Kind regards.
- The topic ‘Rank math auto keywords’ is closed to new replies.