Title: Remove &quot;Delete Cache&quot; button from admin bar
Last modified: August 21, 2016

---

# Remove "Delete Cache" button from admin bar

 *  [Tom](https://wordpress.org/support/users/jeffreeeeey/)
 * (@jeffreeeeey)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/)
 * Hi,
 * I am trying to remove the DELETE CACHE button from the WP admin bar completely
   as it’s not used by me or my clients.
 * I have removed most of the other admin bar buttons by using this custom function:
 *     ```
       function smb_admin_bar() {
           global $wp_admin_bar;
           $wp_admin_bar->remove_menu('wp-logo');
           $wp_admin_bar->remove_menu('about');
           $wp_admin_bar->remove_menu('wporg');
           $wp_admin_bar->remove_menu('documentation');
           $wp_admin_bar->remove_menu('support-forums');
           $wp_admin_bar->remove_menu('feedback');
           $wp_admin_bar->remove_menu('view-site');
           $wp_admin_bar->remove_menu('comments');
           $wp_admin_bar->remove_menu('new-content');
   
       }
       add_action( 'wp_before_admin_bar_render', 'smb_admin_bar' );
       ```
   
 * So I assumed I could just add the following and job done:
 * `$wp_admin_bar->remove_menu('delete-cache');`
 * That doesn’t work though. I’ve looked through the WPSC fplugin files and I’m 
   99% certain that “delete-cache” is the ID you have given the button, so I don’t
   understand why this isn’t working?
 * Note: I have searched for a solution to this and it appears some people are happy
   with un-ticking the “Don’t cache pages for known users” box on the settings page–
   that removes the button.
 * However, that won’t work for me since I don’t want to cache pages for known users…
   but at the same time I simply don’t need the button on my clients sites’ admin
   bar since the cache is cleared when they edit or publish a new page/ post anyway.
 * Any help would be appreciated. Thanks
 * [http://wordpress.org/plugins/wp-super-cache/](http://wordpress.org/plugins/wp-super-cache/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172570)
 * Apologies, if my answer looks stupid.
 * Have you tried a plugin, such as, [http://wordpress.org/plugins/admin-menu-editor/](http://wordpress.org/plugins/admin-menu-editor/),
   to hide the menu?
 *  Thread Starter [Tom](https://wordpress.org/support/users/jeffreeeeey/)
 * (@jeffreeeeey)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172604)
 * I’m not looking to add another plugin as it’s not needed. The author of WP Super
   Cache has added an ID to their admin bar button (DELETE CACHE), so using the 
   code I’ve posted, it _should_ be possible to remove it.
 * I’m still unsure why this isn’t working though.. I have confirmed the ID is “
   delete-cache”, yet adding:
 * `$wp_admin_bar->remove_menu('delete-cache');`
 * ..doesn’t seem to be working. Perhaps the plugin author would care to explain
   why?
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172605)
 * ‘delete-cache’ is the [correct ID](http://plugins.trac.wordpress.org/browser/wp-super-cache/tags/1.3.2/wp-cache.php#L3140)
   and the following code…,
 * `$wp_admin_bar->remove_menu('delete-cache');`
 * works for me. You may turn on debugging in WordPress to see, what’s going behind
   the scene.
 *  Thread Starter [Tom](https://wordpress.org/support/users/jeffreeeeey/)
 * (@jeffreeeeey)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172608)
 * I have tried enabling debug mode but I’m not seeing anything of relation, very
   strange
 *  [Paul](https://wordpress.org/support/users/paulburd/)
 * (@paulburd)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172653)
 * I know this is an older thread, but I just tried your original code and it worked
   for me too.
 *     ```
       function en_admin_bar() {
           global $wp_admin_bar;
           $wp_admin_bar->remove_menu('delete-cache');
   
       }
       add_action( 'wp_before_admin_bar_render', 'en_admin_bar' );
       ```
   
 *  Thread Starter [Tom](https://wordpress.org/support/users/jeffreeeeey/)
 * (@jeffreeeeey)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172654)
 * Thanks Paul. I guess there must be some conflict with another function that I’m
   using in our framework. I’ll need to try debug it when I get a moment.
 * Thanks for the feedback anyway
 *  [Silk7](https://wordpress.org/support/users/silk7/)
 * (@silk7)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172657)
 * Hi, I am a complete newbie to WordPress.org, but so far, all is well. However,
   I don’t know what the “Delete Cache” button is for, or when I should be using
   it? Could someone enlighten me? Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Remove "Delete Cache" button from admin bar’ is closed to new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [Silk7](https://wordpress.org/support/users/silk7/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/remove-delete-cache-button-from-admin-bar/#post-4172657)
 * Status: not resolved