Title: WP Converting Code Formatting
Last modified: August 19, 2016

---

# WP Converting Code Formatting

 *  Resolved [redcore](https://wordpress.org/support/users/redcore/)
 * (@redcore)
 * [16 years ago](https://wordpress.org/support/topic/wp-converting-code-formatting/)
 * Posting a code blog has always seemed to be somewhat of a difficult thing to 
   do (many blogs don’t support syntax highlighting, for one). I like WP and I have
   SyntaxHighlighter Plus installed and thought everything was going pretty well
   on my first blog post. Unfortunately, upon the first draft save all of the code
   formatting was converted by WP. Normally this is fine, but not for code snippets.
 * Before saving the draft: [http://shinytype.com/images/code-good.jpg](http://shinytype.com/images/code-good.jpg)
   
   After saving the draft: [http://shinytype.com/images/code-bad.jpg](http://shinytype.com/images/code-bad.jpg)_(
   note that I do not use the visual editor)_
 * Am I missing something?
 * Here’s how that blog of code looks like in the HTML editor:
    `[PHP]<?php $server
   = ""; // aka "localhost" or "69.249.73.42" $username = ""; // aka "ChuckNorris"
   $password = ""; // aka "Eatsnails4_breakfast" $database = ""; // where you want
   your new table to go
 * mysql_connect($server, $username, $password) or die(mysql_error());
    mysql_select_db(
   $database) or die(mysql_error()); ?>[/PHP]
 * I’d be totally bummed if I have to build a blog by hand to make this work, so
   I hope it’s just something I’m not quite attune to quite yet. Thank you!

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

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [16 years ago](https://wordpress.org/support/topic/wp-converting-code-formatting/#post-1509441)
 * Try this instead (from the HTML editor):
 *     ```
       <code><?php
       $server	 = "";	// aka "localhost" or "69.249.73.42"
       $username	= "";	// aka "ChuckNorris"
       $password	= "";	// aka "Eatsnails4_breakfast"
       $database	= "";	// where you want your new table to go
   
       mysql_connect($server, $username, $password) or die(mysql_error());
       mysql_select_db($database) or die(mysql_error());
       ?></code>
       ```
   
 *  Thread Starter [redcore](https://wordpress.org/support/users/redcore/)
 * (@redcore)
 * [16 years ago](https://wordpress.org/support/topic/wp-converting-code-formatting/#post-1509563)
 * It cuts off the opening PHP tag, ends up looking like this:
 *     ```
       $server	 = "";	// aka "localhost" or "69.249.73.42"
       $username	= "";	// aka "ChuckNorris"
       $password	= "";	// aka "Eatsnails4_breakfast"
       $database	= "";	// where you want your new table to go
       mysql_connect($server, $username, $password) or die(mysql_error());
       mysql_select_db($database) or die(mysql_error());
       ?>
       ```
   
 * Also, syntax highlighting doesn’t work with code blocks.
 *  Thread Starter [redcore](https://wordpress.org/support/users/redcore/)
 * (@redcore)
 * [16 years ago](https://wordpress.org/support/topic/wp-converting-code-formatting/#post-1509568)
 * Switched to SyntaxHighlighter Evolved and the problem is solved
 * [http://wordpress.org/extend/plugins/syntaxhighlighter/installation/](http://wordpress.org/extend/plugins/syntaxhighlighter/installation/)
 * Thanks for your help, macmanx 🙂
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [16 years ago](https://wordpress.org/support/topic/wp-converting-code-formatting/#post-1509581)
 * You’re welcome!

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

The topic ‘WP Converting Code Formatting’ is closed to new replies.

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [formatting](https://wordpress.org/support/topic-tag/formatting/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [James Huff](https://wordpress.org/support/users/macmanx/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/wp-converting-code-formatting/#post-1509581)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
