WordPress-Super-Cache and Text-Link-Ads Fixed!
For ages Ive been trying to figure a way to get super-cache to work with Text-Link-Ads, and now I have the solution!
The cache would only work in ‘half-on’ mode, if ‘full’ caching was enabled folders would be created in the cache folder but no files were written. This is because TLA was altering every post and page looking to see if it had to insert an advert.
After a lot of searching around I found out you can tell the cache which files to ignore totally by setting DONOTCACHEPAGE to true, so I looked through the TLA plugin code and eventually found the a place for it, so DONOTCACHEPAGE gets defined only on a post/page that actually has an ad to insert.
On to the fix…
open up the TLA plugin file and look for this line around 589:
[php]if (isset($this->ads[$postId]) && is_array($this->ads[$postId])) {[/php]
Add blelow this line:
[php]define(‘DONOTCACHEPAGE’, true);[/php]
so the codeblock will look like this:
[php]function insertInLinkAd($postId, $content)
{
if (isset($this->ads[$postId]) && is_array($this->ads[$postId])) {
define(‘DONOTCACHEPAGE’, true);
foreach($this->ads[$postId] as $ad) {
$second = false;
$specialChars = array(‘/’, ‘*’, ‘+’, ‘?’, ‘^’, ‘$’, ‘[‘, ‘]’, ‘(‘, ‘)’);
$specialCharsEsc = array(‘/’, ‘*’, ‘+’, ‘?’, ‘^’, ‘$’, ‘[‘, ‘]’, ‘(‘, ‘)’);[/php]
You can now activate full mode in super cache and turn on gzip!