WordPress.org

Support

Support » Plugins and Hacks » Prevent random posts load for being cached

Prevent random posts load for being cached

  • Hey,

    my posts are randomly loaded at my home.php. But not with that plugin. How can I exclude it for being cached?
    Function is:

    // Random posts load
    function random_home_posts($query) {
       if($query->is_main_query()){
          if ($query->is_home()) {
            $query->set('orderby', 'rand');
          }
        }
    
    };
    add_action('pre_get_posts','random_home_posts');

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • By default this plugin doesnt cache GET query urls. If that is the same case with you, you could merely just add a “?” to your url and it wont be cached.

    If you are caching Gets then just append this to the url: &qcAC=0 to prevent caching.

    Thank you.

    Where must I add this “?” or “&qcAC=0”?

    Oops…i think i misread your post. From what i am gathering you are showing a page and on that page you are trying to randomize a list ordering each time a user visits that page.

    Just to be clear Quick Cache caches an entire page and so to update a portion of a page you will need to refresh the cache of the entire page.

    You are free to use javascript coding to randomize the ordering at least that way there would be no need to fiddle with Quick Cache at all (you would let it continue to cache the page for as long as it wants). That is what i would do.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Prevent random posts load for being cached’ is closed to new replies.