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

Advertisement

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.