WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some posts are requested through Ajax.

// Filename: ajax-posts.php
require_once "wp-load.php";
echo my_get_post($_GET["id"]);

How can I make theese Ajax requests cacheable by W3 Total Cache?

share|improve this question

closed as off-topic by gmazzap, Pieter Goosen, shea, ialocin, birgire Aug 22 '14 at 15:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

For something like this, would it be more effective to use the Wordpress Transients API and cache the requests that way? Also, is there a specific reason you're not routing the ajax requests through admin-ajax.php and using a wp_ajax_ action instead of including wp-load.php? I'm not sure what your set-up or intent is with this and I don't wnat to steer you wrong, so maybe someone else can chime in, too. – Eric Allen Oct 4 '12 at 4:00
up vote 1 down vote accepted

Short answer: You can't. Getting W3 Total Cache to talk to a non-WP call in manor listed above isn't (easily) possible. I completely agree with @allenericr comments. The Transients API is very straight forward and quite simple to implement. In addition, @allenericr, comment on using admin-ajax.php is also spot on. It's not sure it's best practices to just include wp-load and call it good (sounds like a big security hole).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.