Support » Plugin: Yoast SEO » Image caption in meta description
4 years, 1 month ago
WordPress version: WordPress 3.5.1.
WordPress SEO version: 1.4.4
How Can I remove caption text (<p class=”wp-caption-text”>) wich appears in meta description if I put a picture before text ?
3 years, 7 months ago
I would also like to know how this can be avoided.
It’s possible to override the description text template on a per-page basis using the Yoast Meta Box on the page/post editor screen.
However if the plugin could be smart enough to disregard any text in captions all together that’d be great.
3 years, 1 month ago
I’m not use Yoast but I had to do something similar with the Zoom Framework SEO settings.
It boiled down to using something like this in the function where the meta descrption is being create:
// remove [caption] shortcode
$content = preg_replace("/\[caption.*\[\/caption\]/", '', $post->post_content);
Various other processing is then done to $content before being output in the meta description tag.