WordPress.org

Ready to get started?Download WordPress

Forums

Quick Cache (Speed Without Compromise)
Prevent random posts load for being cached (4 posts)

  1. Julian
    Member
    Posted 1 year ago #

    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/

  2. Kimberly
    Member
    Posted 1 year ago #

    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.

  3. Julian
    Member
    Posted 1 year ago #

    Thank you.

    Where must I add this "?" or "&qcAC=0"?

  4. Kimberly
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic