You are here

Blog

Drupal 6.x Custom Clear all Cache Link / Page

Create a page, set the body input filter to PHP and paste the following code in the body. Add a menu link to your navigation or admin menu for easy access to clear the cache.

<?php
// only allow site administrators to visit this page:
if (!user_access('administer site configuration')) {
 
drupal_not_found();
}
else {
 
drupal_clear_css_cache();
 
$tables = array(
   
'cache',
   
'cache_content',
   
'cache_filter',
   
'cache_menu',
   
'cache_page',
   
'cache_views',
  );
  foreach (
$tables as $table) {
   
cache_clear_all('*', $table, TRUE);
  }
 
drupal_set_message('Cache cleared.');
 
drupal_goto();
}
?>
Drupal
Cache

Need A Developer? Contact Us