Skip to main content

Interesting WordPress Bug – Help Needed

I’ve encountered a small WP bug in a critical feature on the blog this morning, and since it has me baffled I thought I would post it and ask for help.

Whenever I write a review or long post, I like to add an auto-generated TOC (this one). It’s a quick and easy way to add a useful feature without having to code the TOC by hand. The TOC is added by way of a shortcode which looks something like this:

[- – – ATOC – – -] (spaces added so you can see the hyphens)
[- – – TAG:h2 – – -]

Unfortunately, some time in the past week WordPress has decided that when I type in 3 hyphens what I really wanted was an mdash. (This issue may have been caused by the WP 4.0.1 security update on Thursday.)

– – – becomes —

Yes, that is a common typography trick, but WP didn’t used to muck around with shortcodes. Now WP is changing the text inside the shortcode and that broke the TOC.

I have already contacted the developer of the TOC plugin, and I am about to go complain to Automattic, but if anyone knows how I can patch this myself I would really appreciate it.

Update: A developer acquaintance of mine pointed me at a support thread on which explained that the broken shortcode was a known issue with that recent WP update and was the result of the plugin not being programmed correctly.  So I guess I will have to wait for the Plugin’s developer to update.

Similar Articles


DaveZ November 22, 2014 um 10:09 am

Prior to whatever hit your site, I’ve been using two dashes to make an extra long dash for years… so that was indeed already present. And, as I mentioned on Twitter, I’ve been able to duplicate your results both in text and visual editors. What’s weird, I would think it should only do that if there is space on either side of the three dashes. But should not alter the text if it’s part of a longer string. Weird.

DaveZ November 22, 2014 um 10:13 am

Of course, they have a long history of tampering with our text. If you type WordPress, it’s auto-corrected to WordPress. So who knows.

DaveZ November 22, 2014 um 10:14 am

Ha, if you type Word press with a lower case P it goes upper case. See, they took the liberty of editing my comment for me. Matt knows best.

Nate Hoffelder November 22, 2014 um 10:23 am

LOL. That was funny.

DaveZ November 22, 2014 um 10:16 am

By the by, your footer ads aren’t showing. It just has in there. Is that your Amazon rollover code? If so, do this instead (without the spaces).

DaveZ November 22, 2014 um 10:16 am

OK so that didn’t work. Even fake HTML is stripped. Will tweet you.

Nate Hoffelder November 22, 2014 um 10:23 am

The footer ads have no rollover code. Those symbols are vestigal.

Nate Hoffelder November 22, 2014 um 10:26 am

Yep. And I have seen the issue elsewhere

Felix November 22, 2014 um 11:27 am

All I can tell you is that WordPress 4.0.1 breaks all shortcodes that don’t go through the standard parsing mechanism, as explained here: — and yours appear to fall into that category. A lot of people are pissed off about it, too. The plugin author can fix it, but at the cost of changing the syntax. Which means you’d have to go back and change all posts using it. A fine mess…

Sorry for the bad news. Can you wait for a few days and see how the story evolves?

Nate Hoffelder November 22, 2014 um 11:35 am

Yep. An acquaintance on Twitter pointed me to the thread on

It’s interesting that the post you linked to says that this should not have been included in this update.

Kevin de Harde November 22, 2014 um 12:17 pm

The smaller plugin I just sent you does use the standard parsing mechanism Felix mentions. Hope it works out.

Nate Hoffelder November 22, 2014 um 12:52 pm

It works, thanks!

DaveZ November 22, 2014 um 7:50 pm

The issue is larger than plugin syntax. Why is WordPress rewriting what I put in the editor? I don’t have Nate’s plugin, yet three hyphens morphs into something else.

Nate Hoffelder November 23, 2014 um 9:05 pm

That kind of syntax change is not so unusual. When typewriter still ruled, you used to have to make an mdash out of hyphens, so this is kinda a holdover.

Breaking the plugins without any need to do so, on the other hand, is best described as user-hostile programming.

DaveZ November 24, 2014 um 8:16 am

I’m fine with concatenating three hyphens into an mdash. But it shouldn’t automatically happen if that text is part of a larger text string – only if surrounded by non breaking spaces. And I still don’t care for capitalizing that P in wordpress. At least they got rid of the smiley face tracker.

bainternet December 12, 2014 um 1:46 pm

as the developer of the plugin in question first let me say that its fixed and no you dont have to go over your old posts and change the syntax , so thanks.

Now as for "shortcode not being programmed correctly"
its not a shortcode and it never was so its not something that fall’s into the whole "bad practice shortcode development".

The plugin filters the content using the_content filter to add anchor tags in to the content. trust me I know the shortcode API inside out after developing my shortcodes UI plugin.

And last, an update like that (WordPress 4.0.1) which impacts the content on the front-end of the site shouldn’t be an auto-update nor a change like that shouldn’t go live without notifying plugin and theme developers in advanced .
The same way that JavaScript libraries updates are being notified in advance.

Nate Hoffelder December 12, 2014 um 2:09 pm


I saw the update a few days ago, thanks. (I also bugged you a bunch of times without a response, thanks for that as well.) I need to update this post.

"And last, an update like that (WordPress 4.0.1) which impacts the content on the front-end of the site shouldn’t be an auto-update nor a change like that shouldn’t go live without notifying plugin and theme developers in advanced."

I agree with you completely. Shit like this is one of the reasons I don’t like Automattic.

bainternet December 12, 2014 um 2:14 pm

Sorry for the response time but I was in a car accident which made me "out of service" for about two weeks, But I’m ok now.

Write a Comment