• Resolved dimail

    (@dimail)


    in the global product description settings, I entered my tex, but it is not displayed. It shows a short description of the product, not my text

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @dimail,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    Please note that this is the order we follow to generate meta descriptions for WooCommerce product:
    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

    To force the use of the description you have set in Global product settings (Rank math > Titles & meta) you can add the following filter to your active theme’s functions.php file:

    /** * Use the Description from Global Setting, if the description is missing in the Post metabox */ add_action( 'rank_math/frontend/description', function( $description ) { global $post; $desc = RankMath\Post::get_meta( 'description', $post->ID ); if ( is_product()) { $desc = RankMath\Helper::get_settings( "titles.pt_{$post->post_type}_description" ); if ( $desc ) { return RankMath\Helper::replace_vars( $desc, $post ); } } return $description; });

    You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thread Starter dimail

    (@dimail)

    I found this filter:

    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; });

    it is different from yours, what is the difference between them?

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @dimail,

    In programming, often there are multiple ways to get the same output and that is the case here.

    We would suggest using the one we shared in our initial response which we just tested now to be working properly.

    Thank you.

    Thread Starter dimail

    (@dimail)

    Thank you for your help

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Glad that helped, @dimail!

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter dimail

    (@dimail)

    it is necessary that the global description be applied to all products, regardless of whether the product has a description or not.

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @dimail,
     
    Yes, the filter we previously shared will apply to all your products even if they don’t have short or long descriptions.
     
    Looking forward to helping you. 

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘the global description for products does not work’ is closed to new replies.