How can I make description 150 symbols length?

#34430
  • Resolved Limbotron
    Rank Math free

    Using Rank Math 1.0.39.1. I have two questions:

    1. I choose %excerpt% for Single Product Description. It takes all the product description and it is too long. How can I make description 150 symbols length?

    2. I tried to change Single Product Description, for example, from %excerpt% to %title% and it does not work. Meta descriptions stays as before.

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

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

    I have been able to replicate this problem on my end and this has been submitted to our dev team for closer investigation.

    To trim the descriptions at this moment, you can add the following code to your theme’s functions.php file:

    /**
     * Allow changing the meta description sentence from within the theme.
     *
     * @param string $description The description sentence.
     */
    add_filter( 'rank_math/frontend/description', function( $description ) {
    	if(is_product()){
    		return wp_html_excerpt($description, 155 );
    	}
    	return $description;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Todd
    Rank Math free

    Hi,

    About your second issue, 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 this filter to override WC excerpt and use the Global template https://rankmath.com/kb/filters-hooks-api-developer/#use-global-meta-description

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

    Thanks for the help!

    Todd
    Rank Math free

    Hi,

    We are so glad to be of help. We are always here if you need us in the future.

    Hey, if it isn’t too much to ask for – would you mind leaving us a review here?

    https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post

    It only takes a couple of minutes but helps us tremendously.

    It would mean so much to us.

    Thank you.

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

The ticket ‘How can I make description 150 symbols length?’ is closed to new replies.