Drupal – Add clear cache link on menu

We can create a page which will clear the cache when it is loaded, and then add a new menu item linking to that page.

1. Create a new page with the following PHP code.

<?php
  drupal_flush_all_caches();
  drupal_set_message('cache flushed.');
?>


 

2. Make sure the body is set with PHP code input text format.
 

3. Add a new menu item.
 

So now whenever the user click the new menu item link, the Drupal cache will be cleared. And this approach also works in Drupal 7.

Done =)

Reference: A page to clear your cache

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s