Remove shortcode from All in One SEO Pack in WordPress 2.6

July 18, 2008

in Code

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.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • Twitter

Related posts:

  1. Add Custom Taxonomy Title Tags Support to All-In-One SEO Pack
  2. How to turn off captions in WordPress 2.6
  3. Nofollow SEO for your WordPress Functions
  4. WordPress Debt Calculator
  5. Incorporate WordPress with Interspire Shopping Cart

1 trackback

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

17 comments… read them below or add one

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…

Reply

Kevin September 19, 2008 at 8:46 am

Thank you very much for this fix

Reply

Zack Katz September 19, 2008 at 9:04 am

@Kevin – Glad to be of assistance.

Reply

Chris September 19, 2008 at 9:23 am

What does this line do? Anything?
$text = str_replace(‘]]>’, ‘]]>’, $text);

Reply

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!?

Reply

Chris September 19, 2008 at 11:21 am

:) no. But thanks for the regex. I’ve used it to patch the_excerpt_reloaded plugin.

Reply

Alan October 4, 2008 at 3:31 pm

Thanks. This worked perfectly for me.

Reply

ChuckMcB October 13, 2008 at 7:27 am

Excellent fix, working fine for me.

Cheers

Reply

yair October 16, 2008 at 1:20 pm

Awesome fix! Thanks Zack!

Reply

Yogi November 30, 2008 at 8:47 am

Thanks for the patch mate, I worked like a charm :) .

Reply

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.

Reply

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!

Reply

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.

Reply

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/

Reply

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/

Reply

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.

Reply

Florida SEO January 24, 2010 at 3:31 pm

I believe the WordPress plugin Platinum SEO Plugin is far superior to the All in One SEO Pack due to the fact that you can just do more! Below are a few of the features of the platinum seo pack that I like:

•    use advanced title rewrite
•    add canonical url’s
•    adds the noodp meta tag
•    adds the noydir meta tag
•    nofollow external links on homepage
•    noindex Rss feeds including comment feeds
•    noindex comment pages of posts
•    noindex date based archives
•    Use categories for meta keywords
•    add additional headers for pages and posts
•    Autogenerate descriptions
•    nofollow archive listings
•    nofollow category pages
•    nofollow tag pages
•    nofollow search result pages
•    log important events
•    nofollow registration links
•    track permalink changes as well!

As a <a title=”Florida SEO” href=”http://seosport.com/florida-seo/”>Florida SEO</a> Company we have worked with many different WordPress websites and have found this to be the best SEO plugin ever made for WordPress SEO!!!

Reply

Leave a Comment

Previous post:

Next post: