WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
Home page is cached; can't uncache it (5 posts)

  1. davert
    Member
    Posted 3 years ago #

    I am using WordPress for the news section of my site, so it sits in /news/ but the headlines appear via php on my home page, /index.php

    I do not want the home page cached, but it gets cached regardless, and I can't figure out how to define it so WordPress will think it's a page (which would let me tell WP Super Cache not to cache it.)

    I can't figure out any other way to avoid having WP SC NOT cache my home page but still cache news/index.php -- and what's more, even when I tell it not to cache index.php, it seems to do so anyway.

    Any ideas? I've been through WordPress' docs and there's lots of info on how to tell if something's defined as a page, nothing on how to define something as a page if you don't create it within WordPress.

  2. davert
    Member
    Posted 3 years ago #

    Haven't figured this out yet. I did try the instructions on including a dynamic php file but that didn't work either.

  3. Donncha O Caoimh
    Member
    Plugin Author

    Posted 3 years ago #

    You can define the constant DONOTCACHEPAGE if the url matches your homepage. That will stop the plugin caching.

  4. davert
    Member
    Posted 3 years ago #

    Thanks. I'll search for info on that. ... looks like this is the code (for anyone else watching; code taken from arclyte):

    function wp_super_cache_dont_cache() {
    	global $wpdb, $current_blog;
    
    	if($wpdb->blogid != 2) {
    		define( "DONOTCACHEPAGE", true );
    	}
    }
    
    add_action("init", "wp_super_cache_dont_cache");
  5. davert
    Member
    Posted 3 years ago #

    ... this looks like it does the same thing... if you don't hear back it worked...

    define( "DONOTCACHEPAGE", true );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic