WP Super Cache
WordPress in directory and cache on post edit not removed (3 posts)

  1. Naki
    Posted 3 years ago #

    Hello there,
    I have WordPress installed in directory: example.org/news

    WP Super Cache is created under:
    -> Works OK

    WP Super Cache Settings tab:
    Button to delete all cache files
    -> Works OK

    Post edit page:
    Edit/change post and click save
    -> Error, cache files ale not marked as .needs-rebuild and users get old page version.

    I looked at get_current_url_supercache_dir() function and it returns bad directory path (when deleting cache only, good path for creating):
    instead of:

    Is it WP-Super-Cache bug ?
    It generates path with /news/ when creating cache
    And generates path without /news/ when tries to remove cache on post change

    For hot fix I changed this:
    global $cached_direct_pages, $cache_path, $wp_cache_request_uri;
    global $cached_direct_pages, $cache_path, $wp_cache_request_uri, $wp_cache_home_path;

    And this:
    $uri = str_replace( '\\', '', $uri );

    $uri = str_replace( '\\', '', $uri );
    if(strpos($uri,$wp_cache_home_path) !== 0) {
        $uri = rtrim($wp_cache_home_path, '/') . $uri;

    And now it works for post edit...

    Thanks for some response.


  2. Donncha O Caoimh
    Plugin Author

    Posted 3 years ago #

    Thanks for that but it can't go in there as it is. Sites that use WordPress in a directory but are served from the root will have the extra prefix (news in this case) added to the path. This is tricky :(

  3. Donncha O Caoimh
    Plugin Author

    Posted 3 years ago #

    Fixed it, by putting the rtrim commands in a different place where they won't affect users of the sites described in my previous post.

    Dev version should update in the next 20 minutes if you'd like to give it a go?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Super Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic