WordPress Displaying Code in Square Brackets?

by Damon on December 9, 2008

You probably want to search for shortcode.

Shortcode is the term used for code that bloggers and plugin developers can use to embed code within a WordPress Post or Page.

The purpose of the remainder of this post is to SEO for words that non-coders search for so that people who don’t know what shortcode is can find this post and learn what search terms to use in order to find a solution. I’ll also share the solution to my specific problem.

WordPress Caption and Form Code Not Working

I recently had a problem with another WordPress blog of mine where code nested in square brackets started displaying. In my case, the problem was with the image caption code and with my contact forms (I tried changing contact form plugins to see if that solved the problem.

I stupidly performed a bunch of updates at the same time with only a cursory check in between so I wasn’t really sure what caused the problem. So off I went to Google to figure out if it knew.

The problem was that there weren’t any relevant results in the language that I used for my searches and I didn’t know the correct technical term. My searches included terms like:

  • square brackets display code WordPress
  • WordPress not parsing code square brackets

and similar combinations.

Luckily, I know enough PHP and WordPress to figure out that the technical term for the code that gets inserted in to Posts and Pages in WordPress is shortcode. If you’re having any problems with stuff displaying within square brackets that shouldn’t be displayed, try searching with the term shortcode.

I can’t find the post that helped me but the problem was with the Google Website Optimizer for WordPress plugin.

I hope this helps you figure out your problem.

[edit]I posted a fix for this problem in my Shortcode with Google Website Optimizer for WordPress post.[/edit]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

{ 7 comments… read them below or add one }

Chris January 29, 2009 at 10:08 pm

Yes – this just helped me bigtime. Thanks much.

Now though I’m supremely bummed the Optimizer plugin isn’t working (and doesn’t seem to have been updated recently). You ever work this out or find an alternative?

Damon January 29, 2009 at 10:30 pm

Actually, I’m thinking of writing my own Optimizer plugin.

I haven’t researched it too thoroughly, but the current Optimizer plugin seems to be a little nuclear inserting code everywhere even where it is not necessary.

I think I could write a more precise plugin, but I’m a slow programmer so it would take a fair bit of time and I’ve got a couple of other plugins in various stages of completion.

Chris January 30, 2009 at 5:41 am

I found one other but it only supports one test per site!

There’s gotta be a quick fix to the ContentRobot one we used. Ugh maybe I’ll poke around in the code over the weekend. I need this now! :)

Chris February 1, 2009 at 8:29 am

I think changing the echo statements to return statements in go4wp_tracking_script might do the trick.

Damon February 1, 2009 at 1:25 pm

Chris,

You’re right about the echo statements.

I created a replacement function which I published in my Shortcode with Wordpress Google Website Optimizer Plugin post.

Also you’re email server wasn’t working. You might want to look in to it.

Joker February 4, 2009 at 3:11 pm

Greatings,
Great job. But not enought info. Where can i read more?

Have a nice day
Joker

Heidi June 4, 2009 at 4:09 am

Thank you for posting this! I was googling the ‘code appearing in square brackets’ and found this very helpful post!

Leave a Comment

{ 1 trackback }

Next post: