keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

wrong URL retrieved for subdirectory installation with changed site URL #113

Closed coreykn closed 4 years ago

coreykn commented 4 years ago

If WordPress is installed in a subdirectory and the Site Address (URL) setting is different than the WordPress Address (URL) setting the wrong URL will be retrieved when clearing the home page cache through Cache_Enabler::clear_home_page_cache() or site(s) cache by blog ID through Cache_Enabler::clear_blog_id_cache(). This would lead to unsuccessful cache clearing in those events.

If the hosts are different then an incorrectly named advanced cache settings file would be created in wp-content/plugins/cache-enabler/settings. This would lead to the Cache Enabler settings not working when the cache is handled by the advanced cache.

Solution would be using get_home_url(), which gets the Site Address (URL) setting, instead of get_site_url(), which gets the WordPress Address (URL) setting. The Site Address (URL) setting is where the front end is accessible and will determine the cache structure.

WordPress topic: https://wordpress.org/support/topic/updating-a-post-does-not-clear-homepage-cache/