Displaying source code in your WordPress posts is extremely simple, you can add a <code> tag around your code and it will be displayed in your blog post.

The problem with the <code> tag in WordPress

As pointed out in Writing Code in Your Posts from the WordPress Codex, a few issues can arise from using this method if you are not careful. Using the <code> tag doesn’t tell WordPress to strip the HTML references from the post.

The Solution to displaying code in WordPress

SyntaxHighlighter Evolved

The SyntaxHighlighter Evolved allows you to easily embed code in your WordPress blog using simple short code to give a nice looking formatted code in the frontend post display.

Simply using the following shortcode structure, your code snippets can be displayed elegantly in your post.

Display shortcode in WordPress post

You can see a better example SyntaxHighlighter Evolved plugin use on our post –

How to only show the admin toolbar for administrators in a WordPress website

What is your favorite method to display code in WordPress posts?



~|map-marker~|font-awesome~|solid

106 Nelson Circle, Olathe, KS 66061

meetings by appointment only

~|phone~|font-awesome~|solid

Did you find this article useful?

Thanks for reading! If you learned something from this article,
please take a moment to leave us a review, recommendation or subscribe.
(you’ll be our best friend)

subscribe to our newsletter

(913) 229-4006
Schedule a Consultation