Single Product Description Template Doesn’t Work

#81639
  • Resolved Minhajul Haque
    Rank Math free

    Hi there,

    Hope you’re well and doing great! I’m experiencing some undesirable issues Single Product Description Template. It’s not working as it’s described in your post Titles and Meta Options and Settings.

    The description I wrote there in the template is not being used in my single product pages’ meta description. It rather remains empty and after publishing the product it pulls out my Product Short Description and uses it as the meta description for the product. However, Single Product Title Template works exactly the way it’s described in your article.

    Please let me know if I’m doing anything wrong or the plugin has an issue that needs to be addressed.

    Awaiting your response!


    Best,
    Minhajul

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael Davis
    Rank Math pro

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

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

    Minhajul Haque
    Rank Math free

    Hi Michael,

    Thank your for your sincere assistance! Yes, it worked for me. I really appreciate your time and kindness.

    Have a great day! Stay healthy; stay well!


    Minhajul

    Michael Davis
    Rank Math pro

    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 3 replies - 1 through 3 (of 3 total)

The ticket ‘Single Product Description Template Doesn’t Work’ is closed to new replies.