Hello @wpangel,
Thank you for contacting Rank Math support.
This is the order we follow to generate meta descriptions for WooCommerce products:
1. Content from SEO Description field
If that is missing, then:
2. WooCommerce Excerpt or Product Short Description
If that is missing, then:
3. Template From General Settings in WordPress Dashboard > Rank Math > Titles & Meta > Products
If that is missing, then:
4. Auto generated Content from the product page (long description)
Since you are adding the description in the Titles & Meta, your short description will override that. Please add the filter given below to add the description from the global settings. Please note that the filter will add the correct description in the front end but you will still see the short description in the snippet editor of the meta box.
add_action( 'rank_math/frontend/description', function( $generated ) { if ( ! is_product() ) { return $generated; } global $post; $desc = RankMath\Helper::get_settings( "titles.pt_product_description" ); $desc = RankMath\Helper::replace_vars( $desc, $post ); return empty( $desc ) ? $generated : $desc; });
Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps. Let us know if you need any other assistance.
I don’t understand why the global settings are not applying to the products when I come from Yoast plugin. If I entered it in the global settings, it applied to everything there without having to deal with separate codes. Why isn’t the global setting working here, and if I want to, then afterward, I provide something individually? We can’t create a separate description for each of the 10,000 products.
Hello @wpangel,
As we have previously mentioned, we are prioritizing the description entered in the meta box and the short description over the global settings (Single Product description) by default:
https://rankmath.com/kb/how-to-set-product-meta-description/#how-product-meta-description-is-selected
However, you can use the filter we have shared to change that behavior to match your needs.
Also, you should edit this line in the code so you can still have a custom description per product:
if ( is_product() && (empty($desc))){
Here’s the modified filter you can copy and paste:
add_action( 'rank_math/frontend/description', function( $generated ) { if ( ! is_product() && (empty($desc))) { return $generated; } global $post; $desc = RankMath\Helper::get_settings( "titles.pt_product_description" ); $desc = RankMath\Helper::replace_vars( $desc, $post ); return empty( $desc ) ? $generated : $desc; });
Hope that helps.