WordPress.org

Ready to get started?Download WordPress

Forums

Quick Cache (Speed Without Compromise)
[Plugin: Quick Cache ( Speed Without Compromise )] QuickCache and GeoIP redirection (5 posts)

  1. MonkeyPress
    Member
    Posted 1 year ago #

    We have a rather large WordPress site (17,000+ pages) that could definitely use some QuickCache love. The site runs the WordPress Multilingual (WPML) plugin to translate the site into 7 languages. When a user first comes to the site we make a GeoIP call to detect where they're coming from in the world and then redirect them to the appropriate language for their location. WPML then sets an "_icl_current_language" cookie on their browser for the language they're currently on. Since we need to run this bit of code, we haven't been able to use a caching plugin in the past. Is there a way to hook into quick cache and make this call before it loads the cache file?

    http://wordpress.org/extend/plugins/quick-cache/

  2. 3x7
    Member
    Posted 1 year ago #

    +1
    I also use GeoIP redirection, but only on the main site within WPMU.
    It does not work with quick cache.

    Possible solution would be to disable it for certain pages/sites.

    Check I'm a plugin developer... section, at the bottom of the faq:
    http://wordpress.org/extend/plugins/quick-cache/faq/

  3. MonkeyPress
    Member
    Posted 1 year ago #

    I saw the part about being able to disable the plugin on a page by page basis. The downside to this is that our entire north america site would be un-cached. Overall the entire site can be cached minus this one little piece.

    I'll dig into the plugin code a bit and see if I can slide my GeoIP call in before QuickCache is activated. We set a session on the page once GeoIP picks a language so if that session doesn't exist I could set that QUICK_CACHE_ALLOWED variable to false for the page. The next time the user sees a page they would get a cached version.

  4. MonkeyPress
    Member
    Posted 1 year ago #

    I think I might have figured this one out. I dropped the below block of code into my wp-config.php file. If the language session variable isn't set I simply disable quick cache. My theme function gets called and runs as usual to detect the users location. Then on the next request the user has their session set so my if statement would be ignored. It seems pretty simple, but I think it'll get the job done.

    session_start();
    if (!$_SESSION['language'])
    {
    	@define ("QUICK_CACHE_ENABLED", "0");
    }
  5. 3x7
    Member
    Posted 1 year ago #

    I manged to make it work with different theme for redirection sites/main site

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic