Adding Code Snippets in WordPress Posts and Pages

Have you ever come up with a wordpress coding solution and wanted to share it with others on your blog but the matter of fact is wordpress by default doesn’t allow you to post code snippets in posts or pages. !Da*n it! solution remains a solution for you and not a HELP Article for others…


I recently found myself in the same situation and was cought in another trouble while posting code snippets in posts but in the next hour i was carrying hundreds of solutions for my blog to resolve this problem. I am going to share the best solutions here in this post. Keep reading and dont forget to share it with others. ūüôā

Solution begins with a plug and play system. Ofcourse with plugins, we can do that. So here are the best ready made solutions (Plugins) i found on internet.

Google Syntax Highlighter

This plugin easily integrates the Google Syntax Highlighter by Alex Gorbatchev into WordPress.

Feature summary

  • 100% client side, no server dependency
  • Multiple languages support
  • Wide browser support
  • Very lightweight

Languages Supported

  • C++ (cpp, c, c++)
  • C# (c#, c-sharp, csharp)
  • CSS (css)
  • Delphi (delphi, pascal)
  • Java (java)
  • Java Script (js, jscript, javascript)
  • PHP (php)
  • Python (py, python)
  • Ruby (rb, ruby, rails, ror)
  • Sql (sql)
  • VB (vb,
  • XML/HTML (xml, html, xhtml, xslt)



WP Advanced Code Editor WP Plugin

WP Advanced Code Editor integrates the EasyArea advanced code editor into WordPress. This adds real time syntax highlighting, line numbering, full screen editing, and more to the code editor in the “Add New Post” and “Add New Page” screens.

Requires: 2.3 or higher     Compatible up to: 2.7


Developer Formatter WP Plugin

Create a better display of codes on your page/blog. For everybody that publish examples, source-code and some tips about a specific language. This plugin do use of GeSHi highlight system, so you will have support for more then 110 languages, including PHP, ASP, Html, JavaScript, CSS, Java, Python, Delphi, C++, C, Visual Basic and much more.


  • Non-obstructive filter integration.
  • Syntax highlighting with Style attribute enabled.
  • Syntax highlighting using AJAX.
  • Syntax highlighting in RSS 2.0 feeds.
  • Syntax highlighting with PRE tags .
  • Syntax highlighting in comments.
  • Start line number configuration.
  • Hide toolbar for a code block.
  • CSS !important to for better style.
  • New code theme (Summer)

Requires: 2.5 or higher          Compatible up to: 3.3.2screenshot-2

File Inliner WP Plugin

This plugin displays the content of a file in a post. The content of the file (called a “snippet”) is put in a¬†<pre></pre>¬†block by default.

It has the following advantages over pasting the content of the file in your post yourself:

  • When the file is modified, no need to modify the posts referring to it
  • Indentation is preserved by default (useful to show code snippets)
  • Can optionally provide a link to the file (no need to copy-paste your snippet)

If requested (see the preserveformat parameter), the content of the file is put in a <div></div> block, with each line (delimited by the carriage return) in its own <coded_p></coded_p> block.



Code Snippet WP Plugin

Code Snippet was created by Roman Roan and originally hosted at¬† It is powered by the GeSHi engine and is quite possibly the best syntax highlighting engine for WordPress. A large number of languages are supported and it can be easily extended. Since his blog is no longer functioning, I’m attempting to keep his wonderful contribution available so I’ve given it a home at¬† If you find any bugs with it, let me know and I will do my best to resovle them.