How to cache custom pages using W3 Total Cache? [closed]

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?

1 Answer
1

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).

Leave a Comment