Skip to content

Flush all (from header menu) now flushes all WPML registered domains too #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion wordpress/varnish-cache/class/cache/class.instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,24 @@ abstract protected function _delete(array $key);

/**
* Flush the entire cache.
*
* When WPML is activated, all WPML domains are gathered and flushed one by one
*
* @return bool
*/
public function flush()
{
return $this->delete(home_url('/.*'));
// Get all WPML domains
if ( function_exists('icl_object_id') ) {
$success = true;
foreach(icl_get_languages() as $lang) {
$success = ((substr($lang['url'], -1) === '/' ? $this->delete(substr($lang['url'], 0, -1) . '/.*') : $this->delete($lang['url'] . '/.*')) && $success ? true : false);
}
return $success;
}
else {
return $this->delete(home_url('/.*'));
}
}

/**
Expand Down