Title: WordPress &#8211; Impossible to post Code Snippets?
Last modified: August 18, 2016

---

# WordPress – Impossible to post Code Snippets?

 *  [slaughters](https://wordpress.org/support/users/slaughters/)
 * (@slaughters)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/wordpress-impossible-to-post-code-snippets/)
 * I am a developer who wants to share javascript code snippets he has written by
   using WordPress posts.
 * I find that WordPress 2.3 makes this impossible to do
 * I need to be able to post example code I have written in an unformatted manner,
   with spaces and HTML code syntax left in place.
 * In the real world you do this by placing your previously formatted code inside
   the PRE and /PRE tags. The HTML render engine in your browser does no formatting
   to the items inside the tags. Simply displaying them as it would plain text.
 * In the Post editor there is a “CODE” tab you can click on to to enable a “CODE”
   editor which lets you insert HTML tags. It’s here that you can insert the PRE
   tag.
 * **BUT**
 * The second you save the code it returns you to the GUI editor which then collapses
   all your spaces. This makes indentation in your code impossible to achieve. Every
   single line inside a loop, an if statment, etc.. all start in column one.
 * You can post once, then never edit it again, but that would be the only option
   you have.
 * P.S.
 * I’ve tried to use the SyntaxHighlighter pluggin instead of the PRE tag to display
   my code – but it currently has a bug in it which I am waiting to hear back about

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 6 months ago](https://wordpress.org/support/topic/wordpress-impossible-to-post-code-snippets/#post-642660)
 * Turn off the GUI editor entirely, see if that works better for you. Go to Users-
   >Your Profile and disable the visual editor.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/wordpress-impossible-to-post-code-snippets/#post-642662)
 * If you refer to this post of yours:
    [http://wordpress.org/support/topic/140233?replies=1](http://wordpress.org/support/topic/140233?replies=1)
   that’s not really a bug. It’s the plugin’s stylesheet and your stylesheet combined.
 *  Thread Starter [slaughters](https://wordpress.org/support/users/slaughters/)
 * (@slaughters)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/wordpress-impossible-to-post-code-snippets/#post-642672)
 * _“Turn off the GUI editor entirely..”_
 * Thanks – thought I did. Now at least I can post code inside PRE tags with out
   scrambling it.
 * _“..that’s not really a bug. It’s the plugin’s stylesheet and your stylesheet
   combined.”_
 * The style sheet used by the SyntaxHighlighter does not calculate widths properly
   when there is a float:right element in the same container.
 * How is that not a bug?
 * – Whatever – I just fixed it for you. Here is what you need to do. Remove the“
   width:99%” from the dp-highlighter class definition inside the SyntaxHighlighter.
   css file.
 * This works for IE7 and Firefox. For IE6 it works to the extent that the float:
   right element stays on top and is not hidden by the dp-highlighter class item
 * *** In other News ***
 * What’s going on with the GUI editor? Why does modify the code inside the PRE 
   tag?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 6 months ago](https://wordpress.org/support/topic/wordpress-impossible-to-post-code-snippets/#post-642686)
 * > _What’s going on with the GUI editor? Why does modify the code inside the PRE
   > tag?_
 * TinyMCE is not perfect. It’s not implemented perfectly in WordPress either. The
   short of it is that if you want to do anything more complex than text with images
   and links, you should probably disable it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WordPress – Impossible to post Code Snippets?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [18 years, 6 months ago](https://wordpress.org/support/topic/wordpress-impossible-to-post-code-snippets/#post-642686)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
