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.

About Nate Hoffelder (9910 Articles)
Nate Hoffelder is the founder and editor of The Digital Reader:"I've been into reading ebooks since forever, but I only got my first ereader in July 2007. Everything quickly spiraled out of control from there. Before I started this blog in January 2010 I covered ebooks, ebook readers, and digital publishing for about 2 years as a part of MobileRead Forums. It's a great community, and being a member is a joy. But I thought I could make something out of how I covered the news for MobileRead, so I started this blog."

18 Comments on Interesting WordPress Bug – Help Needed

  1. 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.

  2. 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?

  3. Hi,
    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.

    • Hi,

      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.

Leave a comment

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: