• Resolved simmods

    (@simmods)


    I have a problem with the meta description. In some meta description posts, it only takes the download link, here’s an example with one post, and doesn’t take the text before: https://simumods.com/fs19-piotrkowice-map-v2-0/

    Meta description: <meta name=”description” content=”FS19 PIOTRKOWICE MAP V2.0 | FS19_Piotrkowice.zip – 374.4 MB modsbase.com/sharemods.com”/>

    In this post he takes part of the text: https://simumods.com/fs19-road-signs-v1-0-0-0/
    Meta description: <meta name=”description” content=”FS19 ROAD SIGNS V1.0.0.0 | this mod is to extract and place on your map with giants editor.”/>

    How to make it take for a meta description from the beginning of the text

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Rank Math SEO

    (@rankmath)

    Hello @simmods

    Thank you for your message.

    Rank Math does not use WP’s excerpt function instead we have created our own excerpt function which gets the paragraph from content that has the focus keyword or the first paragraph.

    In your content, the first paragraph has a link text that’s why the description is showing the download link.

    We have reported it internally. We can check how WP generates the excerpt from content paragraphs and use the same code in our plugin too.

    For now, please add the following code in your theme’s functions.php file:

    add_filter( 'rank_math/frontend/description', function( $description ) {
    	if ( ! is_singular() ) {
    		return $description;
    	}
    	global $post;
    	$rank_math_description = get_post_meta( $post->ID, 'rank_math_description', true );
    	$focus_keywords        = get_post_meta( $post->ID, 'rank_math_focus_keyword', true );
    	if ( $rank_math_description || $focus_keywords || ! empty( $post->post_excerpt ) ) {
    		return $description;
    	}
    	return get_the_excerpt();
    });

    Hope that helps.

    Thread Starter simmods

    (@simmods)

    Yes, it helped, but when will it be fixed in the plugin

    Plugin Author Rank Math SEO

    (@rankmath)

    Hello @simmods

    The enhancement will be included in the upcoming update.

    We will let you know once that is released.

    Thank you.

    Thread Starter simmods

    (@simmods)

    There is a new update, but I don’t see this issue resolved

    Plugin Author Rank Math SEO

    (@rankmath)

    Hello @simmods

    Sorry, but the fix was not included in the latest update.

    It will be included in the next update.

    We request you to please continue using the code we provided.

    We will let you know once the update is released.

    We seek your patience and understanding in this matter.

    If there’s anything else we can help you with, please let us know.

    We are here to assist. Thank you.

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

The topic ‘Problem with meta description’ is closed to new replies.