WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Turning WP Super Cache ON for ajax requests? (4 posts)

  1. vonkanehoffen
    Member
    Posted 4 years ago #

    Hi there,
    I've been playing with WP Super Cache for a while and it works brilliantly for normal page requests. The trouble is, I have a lot of ajax requests I want to be served from the cache too:

    I'm using a plugin called read-more-right-here that gets a post's content after the more-link using an ajax call, and appends it to the existing page content (it uses jquery to 'slide it out'. very snazzy).

    It does this by requesting the post URL using an ajax request with a special POST variable attached (in this case wt-rmrh-redirect=1), which triggers the plugin (hooked to 'init') to return JUST the post content after the more-link, with it's own query_posts call.

    The trouble is, this isn't cached, presumably because the .htaccess rules are never triggered due to the POST variable, and wp-super-cache's hooks are never called. ...or something like that :-)

    So presumably I need to get this plugin's output written to the /wp-content/cache folder somehow and make a new RewriteRule that's got RewriteCond %{REQUEST_METHOD} ^POST in it somewhere, instead of !POST.

    So, has anyone got anything like this to work? ...or does anyone have any pointers? It's all a bit over my head at the moment and any help would be greatly appreciated!

    Cheers!

  2. vonkanehoffen
    Member
    Posted 4 years ago #

    ...i've also got a feeling that WP Super Cache isn't the best way to do this and I should be using some other plugin alongside it. Any ideas? :-)

  3. Donncha O Caoimh
    Member
    Posted 4 years ago #

    You should cache these requests with an object cache, not a full page caching engine like wp-super-cache.

  4. vonkanehoffen
    Member
    Posted 4 years ago #

    ah right! thanks very much for the advice @donncha
    Sorry I only found your reply now - thought the board would have told me about it :-)

    Much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic