• Resolved cnlselectronics

    (@cnlselectronics)


    Good afternoon ??

    My site doesnt limit the meta description to 160 anymore, although it used to and i’m sure I found code to add to functions to make this limit happen. Since then, we replaced our theme and that code is now gone. I have searched and searched and i can’t find it regardless of search keywords.

    Does anyone have the code to limit this meta description for woocommerce products at all? When i check the meta description via google or any SEO tool the description is in full.

    Thank you in advance!

    Steven

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

    (@rankmathteam)

    Hello @cnlselectronics,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Please try adding the following filter to limit the meta description character to 160, and this will only work for the products.
    add_filter( 'rank_math/frontend/description', function( $description ) {
    if(is_product()){
    $description = substr($description, 0, 160);
    }
    return $description;
    });

    Here’s how you can add filters/hooks to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thread Starter cnlselectronics

    (@cnlselectronics)

    Thank you for the snippet! I have added it to the site files now. Now the meta description for each product page should only show 160 characters to Google is that correct?

    I can see in the RankMath section of editing a product the 160 suggestion. Its set to automatically use the products short description to be the meta description. Which is a lot more than 160 characters. Will this eventually alter this and limit it to 160?

    Thanks

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @cnlselectronics,

    Yes, the limit will be forcefully 160 characters for your products and Google should also not show more than 160 characters.

    Hope that clarifies your doubt.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Meta Description limit’ is closed to new replies.