WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to be able to hide W3 Total Cache from non admins. How can I go about doing so?

The following code I tried implementing in my functions.php file does not work:

function hide_w3tc() {
    if (!current_user_can('super_admin')) {

add_action( 'admin_menu', 'hide_w3tc');
share|improve this question
up vote 2 down vote accepted

You can try to use remove_menu_page(), so you code example would be like:

function hide_w3tc() {
    if (!current_user_can('manage_network')) {
add_action( 'admin_menu', 'hide_w3tc',11);

where we use a priority greater than the default of 10, since the W3TC menu page is added via

add_menu_page('Performance', 'Performance', 'manage_options', 'w3tc_dashboard', '', 'div');
share|improve this answer
This seems to work, thank you. – Matt Mar 26 '13 at 17:14
ok great, by the way you are using a 'super_admin' capability but I usually see the 'manage_network' capability used instead. – birgire Mar 26 '13 at 17:28
I used super_admin as I made a custom user group. I suppose manage_network has more coverage of all the permissions underneath that umbrella? – Matt Mar 26 '13 at 17:31
ok I was just wondering where it came from, since it is not listed here: codex.wordpress.org/Roles_and_Capabilities ;-) – birgire Mar 26 '13 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.