Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Some posts are requested through Ajax.

<?php
// 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
3  
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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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