Starting in WordPress 2.6, they’ve added captions to images that are automatically generated and use the Shortcode API to make it happen. One side effect is that All in One SEO Pack isn’t set up to strip the caption from the automatically generated META tags, so you may end up with in your description.
Thanks to a WordPress Trac entry, I got the right regular expression to strip all shortcode in All in One plugin.
Make the following changes to fix the SEO pack problem:
Edit the file all_in_one_seo_pack.php.
On Line 1059, find:
function trim_excerpt_without_filters($text) {
$text = str_replace(']]>', ']]>', $text);
Below it, add:
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
On Line 1074, find:
function trim_excerpt_without_filters_full_length($text) {
$text = str_replace(']]>', ']]>', $text);
Below it, add:
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
That should do it! Let me know if there are any issues that come up.
Katz Web Design, is a 





17 responses so far ↓
How to turn off captions in WordPress 2.6 « Denver Web Design & Denver SEO - The Katz Web Design Blog // July 21, 2008 at 8:56 am |
[...] Contact KWD ← Remove [caption] shortcode from All in One SEO Pack in WordPress 2.6 [...]
Aikindo // August 11, 2008 at 3:02 am |
Thanks for the fix, I have applied it and it work out successfully.
One question, how long does it take for search engine to revisit and get the new description?
Best regards…
Kevin // September 19, 2008 at 8:46 am |
Thank you very much for this fix
Zack Katz // September 19, 2008 at 9:04 am |
@Kevin – Glad to be of assistance.
Chris // September 19, 2008 at 9:23 am |
What does this line do? Anything?
$text = str_replace(’]]>’, ‘]]>’, $text);
Zack Katz // September 19, 2008 at 10:06 am |
@Chris – Now that you mention it, I have no idea. It would seem to search for
]]>then replace it with the same exact thing! Doesn’t make much sense, does it!?Chris // September 19, 2008 at 11:21 am |
Alan // October 4, 2008 at 3:31 pm |
Thanks. This worked perfectly for me.
ChuckMcB // October 13, 2008 at 7:27 am |
Excellent fix, working fine for me.
Cheers
yair // October 16, 2008 at 1:20 pm |
Awesome fix! Thanks Zack!
Yogi // November 30, 2008 at 8:47 am |
Thanks for the patch mate, I worked like a charm
.
Chetan // December 5, 2008 at 11:44 am |
But when ever we update our plugin it becomes as it was
, we should suggest this to AIO SEO makers.
Zack Katz // December 5, 2008 at 12:05 pm |
Ah, so true. What you could do is add a function in your functions.php file with the right hook…I can’t look into it now, but that may be a good way to avoid updating it!
Zack Katz // December 11, 2008 at 9:32 am |
@Aikindo — I just now saw your question. How often a search engine updates their index of your site depends on the site itself. For most of my clients with static websites, it’s about 2-3 weeks. Updated blog sites should be faster.
Keith // January 18, 2009 at 9:36 pm |
Thanks for this tip! This post helped me to resolve a compatibility issue with the All in One SEO Pack plugin and the WP Remix theme. See my post below for more info…
http://www.doubleblackdesign.com/wp/2009/01/18/all-in-one-seo-pack-and-wp-remix-theme-support/
Mike // January 22, 2009 at 12:49 pm |
I wonder why new versions of All in One SEO Pack plugin keep coming out without this fix?
I have reported it, but they seem to ignore. Why?
Lets contact and nicely ask it be added in:
http://semperfiwebdesign.com/contact/
Mike // January 22, 2009 at 1:34 pm |
Good news!
This is fixed in the latest All in One SEO Pack 1.4.7
No need to worry about it anymore.