Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to display code in my WordPress page and it isn't working. Everything I read says that you should be able to just use pre tag with code tag and it would be good but when I try to display a shortcode, it renders the shortcode rather than displaying the code.

The codex says that using pre and code would work but it isn't for me. Has anyone had this issue? Am I missing something in functions.php that makes this work?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

To display a shortcode instead of rendering it you have two options:

  1. Write [[shortcode]]. WordPress will show this as [shortcode].
  2. Escape the [, write it as as [ or [.
share|improve this answer

Worked for me: [shortcode] where &#91 is [ and ] is ] html codes.

Don't worked for me the one suggested by toscho: Write [[shortcode]]. WordPress will show this as [shortcode].

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.