TOC Malfunction Rumors Disproved Again
In my last post I disproved that SEO Table Of Contents fails to function on a very long post/page with more than 12,500 characters. As it turned out, it wasn’t characters that the issuer meant, but words. So I re-checked with a much longer post.
I discovered two things:
- It is true that the post/page content disappears when the content size increases above a certain limit. (The limit seems to be different on different servers).
- It is not true that this is caused by the TOC shortcode. The content disappears with any shortcode inside the content.
Here is the source code of a simple plugin I used to investigate the issue:
<?php /* Plugin Name: Hackadelic ShortCodeDummy Version: 0.1 Plugin URI: Description: A simple dummy shortcode to test WordPress' shortcode processing. Author: Hackadelic Author URI: http://hackadelic.com */ add_shortcode('SHORTCODE', 'HackadelicShortCodeDummy'); function HackadelicShortCodeDummy($atts, $content=null){ return "{SHORTCODE was here}"; } ?>
It adds the shortcode [SHORTCODE]
, which just yields “[SHORTCODE]”. It attempts no content processing whatsoever. Nonetheless, in a huge post it will make the content disappear, like any other shortcode will. (Note though that you can’t just use [XXX] of the like. The shortcode needs to actually have been registered with wordpress.)
This is not the plugin, but WordPress’ shortcode processing which fails. I examined the issue in the past (in conjunction with similar rumors about Sliding Notes), and came to the conclusion that it is most likely a bug in PHP’s regular expression engine.1
Sorry, nothing I can do about that. 🙁
Interestingly though, a TOC in the sidebar works flawlessly with huge posts. So that’s a possible workaround – if you must write your next novel in WordPress. 🙂
- This explains why on different servers – with different PHP versions and configurations – there are different limits on the post length. [↩]
- TOC Malfunction Rumors Disproved
- TOC Malfunction Rumors Disproved Again