Support » Plugin: WP Super Cache » [Plugin: WP Super Cache] Feature request:: Test for opening XML tag in wp_cache_get_ob()

  • A plugin of mine outputs content in XML format. WP Super Cache isn’t caching these pages because they don’t contain the HTML/RSS elements which are tested for.

    WP Super Cache’s wp_cache_get_ob() function tests for the existence of closing html, rss, feed and urlset tags to determine whether Super Cache should cache the page. My XML pages have none of these, so Super Cache doesn’t cache them. The pages do have a proper XML header which starts with <?xml. It would be great if Super Cache could also check for the existence of this tag to determine if the page should be cached.

    W3 Total Cache happily caches these pages as it checks for <?xml among other things.

    Here’s the required change to the regex in wp_cache_get_ob():


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Donncha O Caoimh


    But what tag goes at the end? </xml> ? That’s the tag that should be checked for as the plugin might try to save an incomplete page.

    Unfortunately there isn’t a closing </xml> tag at the end of an XML document. There’s just the closing tag for whichever container element is used, eg </rss>, </data> or </whatever>.

    Good point about incomplete pages. The plugin could instead look for the first opening tag and then check there’s a matching closing tag. You wouldn’t need the individual rules for /html, /rss, /feed and /urlset then and all situations would be covered.

    Plugin Author Donncha O Caoimh


    Ah, I remember that now from previous conversations about this. That’s why urlset is in there!

    I think I’ll add a filter on that list. I don’t want to go parsing the html of a page finding the first tag and the corresponding tag. A filter will allow this problem to be avoided by those who are working in this space. It’ll be in the next version.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP Super Cache] Feature request:: Test for opening XML tag in wp_cache_get_ob()’ is closed to new replies.