• Resolved santiagouzal77

    (@santiagouzal77)


    Hello how are you?
    I have a multisite, and I need to exclude some blogs.
    Those that have subdirectories I exclude them with the string “/ blogname /” but I have other blogs that have their custom URL (for example https://blogname.com.ar) … How should I write the string to exclude that URL from the cache? I tried “https://blogname.com.ar” “blogname.com.ar” “* .blogname.com.ar” but it didn’t work for me!

Viewing 2 replies - 1 through 2 (of 2 total)
  • @santiagouzal77 You can’t use strings to exclude a mapped domain. The strings function looks through the rest of the URL after the domain.

    I’m not aware of a feature in WP Super Cache that allows excluding a specific site on multisite. However, I have used the following in page templates to exclude them from caching. I assume you could use it in a theme header and then all sites using that theme would be excluded. In your case what you could do is create a child theme and then add a custom header.php that is a copy of the parent theme’s but with the following code added:

    define( 'DONOTCACHEPAGE', true );

    Then all sites using that child theme would not be cached.

    Not sure how to create a child theme? Super easy. Add a unique directory in /wp-content/themes. In your case you could call it parentthemenamedonotcache. Copy the header.php from your parent theme into this directory and edit it to include the following at the start of the php:

    define( 'DONOTCACHEPAGE', true );

    Then add a style.css file in that directory with the following code:

    `
    /*
    Theme Name: parentthemenamedonotcache

    Theme URL: https://www.yourdomain.com/

    Description: parentthemenamedonotcache is a child theme of parentthemename.

    Author: Your Name

    Author URI: https://www.yourdomain.com

    Version: 1.0

    Template: parentthemename

    Tags: whatever you would like to put here.

    */

    /* Your Name No Cache Blog Theme. */

    @import url(“../parentthemedirectory/style.css”);

    /* Add your own css rules for this site below */
    `

    Activate the child theme in Network Themes and then activate it on the sites that you don’t want to cache. Voila.

    Have a great weekend!
    Pat

    • This reply was modified 4 years, 4 months ago by wlpdrpat.

    There is a way – enable the “Multi site” plugin in the plugin settings page and it will add a new row to Network->blogs where you can disable caching for specific blogs!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude cache of URL’ is closed to new replies.