wordpress.com code bug

I like posting source code on my blog. WordPress.com has a bug where it re-escapes my code every time I edit it. I am creating this blog post to file a support ticket, because I’m now a paying customer.

The code I want to post is the Python code

int(“1”) & 2

Ie; take the string 1, cast it to an int, then bitwise and it with the integer 2. I chose this because both the ” and & may get HTML escaped.

I’m following these instructions for posting code. Note they dont’ tell you which editor mode to do this in; Visual or HTML mode. I’m going to do both.

Both of these displayed correctly the first time. But the moment I edited the post again and saved it, it escaped the ” to be " and the & to be & It will keep adding more escaping every time I edit it. It’s very annoying.

Visual mode

int("1") & 2


int("1") & 2


This bug is 4+ years old and yet still with us and seems to have been carried over to WordPress’ new visual editor, Calypso. I suspect they’re doing something naive like re-escaping every single time the editor switches modes. I tried asking wordpress.com front line support and just got a “need to look into this more” reply with a promise of an email followup.

Update: got a reply from support saying it was a known issue they were looking into and that “For now the solution is to stick to the HTML editor when writing code in blocks.” Well, that’s clear. I wonder if any of WordPress’ own engineers use WordPress to blog about code? Doesn’t this drive them crazy?

2 thoughts on “wordpress.com code bug

  1. On a semi-related note, what’s the actual interface/syntax available in your comments box? It seems to do all sorts of magical things like inline gists but it’s unobvious what else it can and can’t do. Markdown? The type of syntax described in those instructions? It seems odd it offers oAuth but no description of the (seemingly) extensive formatting features.

Comments are closed.