Meta description on search engine

hi, for 2 months I have noticed that google is referencing the content of my listing attributes instead of the content of the description area.

I use rank math and it puts me the content of the description area in meta description.

My 1st files do not have this problem, any idea why?

Hi,
In recent versions HivePress uses post_excerpt for generating the internal search snippet (based on the Category labels and Attributes marked as Indexed), this way listings can be found if someone types the attribute, category, location, or vendor name in the Keywords field. I guess Rank Math uses the post_excerpt field for meta description instead of post_content, please check if it has some option for switching this to post_content.

Thank you, yes on Rank Math, the description is with %excerpt% but nothing with %content%. Maybe %excert-only% (excerpt from post without auto-generation) or %term-description% ?

I try it and said you if working when Google update my sitemap, for tell us at your user

Please try this PHP snippet which works only for listings. It will take the listing description, cut it to a maximum of 120 characters (which is recommended meta description length) and show it as a meta description.

add_filter( 'rank_math/frontend/description', function( $description ) {
	global $post;
	
	if (is_object($post) && 'hp_listing' === $post->post_type && strlen( $post->post_content ) > 120 ) {
		$description_parts = explode( ' ', substr( $post->post_content, 0, 120 ) );
		$description_parts[ count( $description_parts ) - 1 ] = '...';
		$description = implode( ' ', $description_parts );
	}
	
	return $description;
});

Thank you, I’ve install it. I said you if work done when Google update my sitemap.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.