Hello,
I apologize for the issue you are facing. When you set a Focus Keyword for a WooCommerce product in the backend using Rank Math, it does not directly appear in the front-end source code as a visible text. Instead, the Focus Keyword is used by Rank Math to optimize various elements of your product page for search engines, which helps Google understand what your page is about.
Here’s how it works:
- SEO Title and Meta Description: The Focus Keyword is often included in the SEO title and meta description, which are visible in search engine results but not necessarily in the page’s HTML source code. You can check these by viewing the page source and looking for
and
tags.
- Content Optimization: Rank Math analyzes your product content to ensure that the Focus Keyword is used appropriately within the product description, headings, and other relevant areas. This helps improve your chances of ranking for that keyword.
- Structured Data: Rank Math may also implement structured data (schema markup) that helps search engines understand the content of your page better, which can include information related to your Focus Keyword.
To ensure that your Focus Keyword is effectively utilized, make sure to include it in key areas such as:
- The product title
- The product description
- The SEO title and meta description (which you can edit in the Rank Math meta box)
If you have further questions or need assistance with specific settings, please feel free to reply to this ticket, and a human agent from our support team will assist you further!
Sources:
Content Analysis Tests for Product Pages » Rank Math
also I added below code to wp-content/themes/woodmart-child/functions.php.
Then I go to edit product page, the focus keyword field is still empty.
/**
* 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’);
Hello,
Thank you for contacting us and bringing your concern to our attention.
Please note that Google does not honor meta keywords for quite a long now so we never added them to the page source.
You can read more about that here:
https://webmasters.googleblog.com/2009/09/google-does-not-use-keywords-meta-tag.html
However, if you still want to use the focus keyword set within Rank Math as a meta keyword then you can add the following filter on your website:
add_filter( 'rank_math/frontend/show_keywords', '__return_true');
Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
You can also check this URL for more details on the focus keyword: https://rankmath.com/seo-glossary/focus-keyword/
Regarding the filter to auto-add focus keyword, you’re using the filter code for posts, not for products.
Please use the following filter code for your products:
function update_focus_keywords()
{
$products = get_posts(array(
'posts_per_page' => -1,
'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_focus_keywords');
Let us know how it goes. Looking forward to helping you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.