WordPress Double Dashes Removed on Post

WordPress Double Dashes -- Removed on Post: By Default the WordPress formatting API automatically converts two dashes or double dashes -- to a single dash --. If you are posting code syntax or Linux command line entries on your blog, this can quickly pose a problem. There are many hard coded core fixes and plugins that work around the dash issue. However, an easier fix is already built into WordPress. Simply use the code button in the html editor.

How to Keep WordPress from removing Double Dashes

  1. Create or edit your new post
    • (1) Click the HTML tab from the editor
    • (2) Select your -- double dashes or entire code snippet containing the dashes
    • (3) Click the Code button (to tag our selection as code) WordPress Preserve Double Dashes
  2. Save your Post and go preview the results

Notes: Wrapping code with <code> </code> tags, tells WordPress not to rewrite specific syntax (such as double dashes), but to leave it as we have typed it.