Rankmath displays product description instead of Global meta description

#76767
  • Resolved Shobhit Agarwal
    Rank Math free

    Hello,

    I’ve configured the default description for single product pages under “Titles & Meta.”

    The plugin displays the same until I add some product descriptions to the single product pages.

    I don’t want the plugin to display product description, instead, I want it to obey the default title set for product meta description.

    I read a few similar tickets in this forum, where you’ve suggested to use the following code.

    
    /**
     * 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 = RankMathPost::get_meta( 'description', $post->ID );
    
     if ( ! $desc && is_product()) {
     $desc = RankMathHelper::get_settings( "titles.pt_{$post->post_type}_description" );
     if ( $desc ) {
     return RankMathHelper::replace_vars( $desc, $post );
     }
     }
    
     return $description;
    });
    

    However, after adding it to the child theme’s functions, the plugin still displays the product description instead of global meta description settings.

    I’m using Astra theme.

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

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

    The filter is only set to work if the description has not been added to the individual product page. To override this and use the global meta in all product pages, you can use it as follows:

    
    /**
     * 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.

    Unfortunately, after adding the provided filter by you don’t seem to fix my issue either.

    The meta description of my product pages still gets overridden as soon as I enter anything under the Product description.

    Please help!

    Alberto
    Rank Math business

    Hello,

    I think we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

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

    Thank you.

    Hello,

    I can’t seem to replicate the issue. Please check the screencast I have attached in the sensitive section and let us know what we are missing.

    Please clear your cche and if the issue still persists, create a screencast with https://www.loom.com and share the URL in the sensitive section.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Thanks,

    Actually, I didn’t check in the page source, instead what I was thinking is that the preview which is generated by the plugin is what is being published on the front-end.

    Anyways, thanks a lot you people, I’m marking the issue as resolved.

    Alberto
    Rank Math business

    Hello,

    We are super happy that you were able to solve 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 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this ticket.