Global “Single Product Description” not working

#83167
  • Resolved Abel Murua
    Rank Math free

    Hi there. This feature is not working. I have changed it and all my products uses woocommerce short description. No matter what dynamic tags I use to build that string, meta description always shows default short description for each product.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    By default, Rank math uses an excerpt of the short product description if no description is added in the description field in Rank math metabox. To use the description set in Global product settings(Rank math > Titles and meta) you can add the following filter to your active theme 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;
    });

    I would have added it for you but the access provided has no access to theme editor

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    I have a custom plugin to add codes, I will add it there then
    Why is is that we have to add this code? Isn´t that feature suppose to do that? or this is a bug at this point?

    I think I am having same problem with Image Title attributes, not showing up.

    • This reply was modified 4 years, 3 months ago by Abel Murua.
    • This reply was modified 4 years, 3 months ago by Abel Murua. Reason: misinterpretation
    • This reply was modified 4 years, 3 months ago by Abel Murua.

    Also, can the product category be added as part as the Title? I tried

    %category% and %categories and not working.

    Hello,

    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

    You can use the provided filter to override WC excerpt and use the Global template https://rankmath.com/kb/filters-hooks-api-developer/#use-global-meta-description

    The %category% variable works only on single items. For the category archives, please use %term%

    Hope that helps.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Am I doing it right? I don’t see the %term% tag working, by working I mean pulling the parent category as text.

    Thank you.

    • This reply was modified 4 years, 3 months ago by Abel Murua.

    Hello,

    The term variable is used for category/tag pages to show the parent category/ta. To get the post category/tag please use the %category% or %tag% variable.

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Not working. Are we talking about woocommerce categories? I put %category% or %tag% variables and nothing.

    I updated the sensitive data for direct access and put two more screen shots.

    • This reply was modified 4 years, 3 months ago by Abel Murua.

    Hello,

    Thank you for the follow up.

    For WooCommerce products, to get the category use %customterm(product_cat)% and %customterm(product_tag)% for the tag

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Perfect! now its working with both. I didnt realzied they were considered custom_terms

    Thank you!

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Global “Single Product Description” not working’ is closed to new replies.