While I was tinkering with my blog site, trying to (somehow) optimize it. I’ve noticed that the “Meta-Description” in which the Add-Meta-Tags generates, included the “[ caption ]” shortcode in the header’s meta-description, that is if I have an embedded image on my post. SEO professionals would say that “it’s a big No no!”. So, what’s a guy gotta do? Remove it! But then I still want a caption for my embedded images (on posts). So, editing every post and removing the code manually will not do.
I’d searched a fix on google but no luck. But, I’ve found one for All-In-One-SEO-Pack using regular expression to strip all shortcode. Tried it on Add-Meta-Tags and you guessed it! It worked!
Here’s how to you do it:
- Edit your ‘add-meta-tags.php‘ from ‘/wp-content/plugins/add-meta-tags-1.6‘ directory.
- Search for the function ‘amt_clean_desc‘
- Then add this code (one line before ‘return trim($desc);‘):
$desc = preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', $desc); - Save it then upload it back to the server.
That’s it!
