Skip to content

W3TC not working due to DONOTCACHEPAGE set in Wordpress SEO?? #419

Closed
sgsthebest opened this Issue Nov 29, 2013 · 7 comments

2 participants

@sgsthebest

Hi,

I'm having a problem with Wordpress SEO and W3TC. In fact, I had it also testing it with WP Super Cache. No cache was working on my site, and debugging it I found that DONOTCACHEPAGE was set to true and then caching disabled. I made a grep and found this variable set in several plugins. I deactivated it one by one and finally discovered that the one causing me the trouble is Wordpress SEO. It was the last I suspected, due to the quality of Yoast's plugins...
Anyway, in file /plugins/wordpress-seo/frontend/class-frontend.php
there is this code:

function title_test_helper( $title ) {
    if ( ! defined( 'DONOTCACHEPAGE' ) )
        define( 'DONOTCACHEPAGE', true);

    if ( ! defined( 'DONOTCACHCEOBJECT' ) )
        define( 'DONOTCACHCEOBJECT', true );

    if ( ! defined( 'DONOTMINIFY' ) )
        define( 'DONOTMINIFY', true );

    global $wp_version;
    if ( $_SERVER['HTTP_USER_AGENT'] == "WordPress/${wp_version}; " . get_bloginfo( 'url' ) . " - Yoast" )
        return 'This is a Yoast Test Title';
    return $title;
}

I don't know why it is needed, but deactivating the plugin brought my cache back. So, as I don't want this plugin deactivated, I changed the code to set the variable to fales. Both plugin and cache seem to work ok, but don't know if I'm causing another trouble.

Anyone else facing the same? Do you have any clue about it?

Regards

@jdevalk
Yoast member
jdevalk commented Dec 9, 2013

Hi, sorry but you've been misinformed. title_test_helper is only called once during setup of the plugin, not all the time.

@jdevalk jdevalk closed this Dec 9, 2013
@sgsthebest
@jdevalk
Yoast member
jdevalk commented Dec 9, 2013

Hmm... That's... weird. Reopening. We should prevent that from happening.

@jdevalk jdevalk reopened this Dec 9, 2013
@jdevalk jdevalk closed this in ce028a7 Dec 9, 2013
@jdevalk
Yoast member
jdevalk commented Dec 9, 2013

I've added in a check to prevent the title test from running forever, that should fix your issue.

@sgsthebest
@sgsthebest

Hi Joost,
I've tested the new version and W3TC works OK, your fix worked like a charm. Many thanks for your support!!
Regards

@jdevalk
Yoast member
jdevalk commented Dec 17, 2013

Perfect, thanks for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.