Support » Plugins » Google accesses post before it has been processed by plugins?

  • I’ve written a wordpress plug-in that automatically generates table of contents for my posts. It generates the TOC only if it sees [[toc]] tag in the post contents. When it sees the tag, it generates the TOC and puts it instead of the tag.

    I ran into this problem and I was wondering how is it possible. My plug-in processes all posts and pages and doesn’t leave the [[toc]] tag in any case I am aware of. Yet, somehow, google managed to cache post contents containing the tag.

    Take this search for example:
    tcpdump for dummies is the name of an article on my blog. Note that the article excerpt google presents contains [[notoc]] and [[toc]]. Both are tags that my plug-in removes – you can see it in the original article:

    In the plug-in, I use
    add_filter(‘the_content’, ‘smart_toc_filter’, 6);
    to register the plug-in. This means that my plug-in should process all posts under any conditions, isn’t it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • If you’re putting the code into the post, you should be using the shortcode api – the benefit of this is that it does all the regex parsing for you to replace [toc] with the plugin output.

    It wouldn’t be too difficult – let me know if you need more help.


    Adam, Thanks for your response.

    To be honest shortcode api doesn’t suite my plug-in very well. It is more suitable for cases when you need to do some processing to some small piece of code. For that to work, you can leave the right shortcode api tag in the post contents and the api will replace it with something meaningful. My plug-in does something a little more complicated.

    It replaces the toc tag with table of contents, but also, it searches for all html heading tags in the post and puts an anchor link around them. When the plug-in generates the toc, it links to the anchors in the toc. It seems to me that with shortcode api it will be much more difficult to do.

    Something tells me that using shortcode api instead of the filter, may fix the problem with google, but before I go on and rewrite the entire plug-in, I want to get to the root of the problem.
    Do you have any idea what it might be?


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Google accesses post before it has been processed by plugins?’ is closed to new replies.