Want to showcase code snippets on your WordPress site without them being filtered out? WordPress automatically sanitizes raw code in posts, pages, widgets, or comments. As experienced WordPress developers, we've helped countless sites display clean, readable code. Here's our proven step-by-step guide using the reliable Syntax Highlighter Evolved plugin.

First, install and activate the Syntax Highlighter Evolved plugin. For detailed instructions, see our step-by-step guide on installing WordPress plugins.
After activation, head to Settings » Syntax Highlighter to customize the options.

The default settings work well for most sites, but review each one—detailed explanations are provided. Adjust as needed and click Save Changes.
This plugin uses simple shortcodes for different languages. Wrap your code in the appropriate shortcode, like this for PHP:
[php]
<?php
echo "Hello World";
>[/php]
It renders as beautifully highlighted, syntax-colored code with line numbers and proper indentation, making it easy for users to copy and paste.
For CSS:
[css]
.entry-title {
font-family: "Open Sans", Arial, sans-serif;
font-size: 16px;
color: #272727;
}[/css]
The syntax highlighter automatically detects the language, adds colors, line numbers, and handles tabs perfectly. Visitors can effortlessly copy snippets directly from your site.
For occasional use—especially if you're not running a dev blog—encode code as HTML entities. For example:
<?php echo "Hello World"; ?>
Manual encoding is tedious, so use an online HTML entity converter. Paste the result into your post and wrap in <code> or <pre> tags for basic styling.
This approach helped us quickly share code in early tutorials before adopting plugins. We recommend Syntax Highlighter Evolved for frequent use—it's battle-tested and trusted by developers worldwide.
You might also like our guide to 13 plugins and tips to enhance your WordPress admin.
If this helped, subscribe to our WordPress YouTube channel for video tutorials. Follow us on Twitter and Facebook for more tips.