Now that is the kind of fiddling I like to do!
Here’s a “works for me” snippet I offer from my “mu-plugins”:
<?php
function ds_w3tc_remove_menu() {
global $submenu, $menu;
if( ! is_super_admin() ) {
if(!empty($menu)) {
foreach($menu as $key => $sm) {
if(__($sm[0]) == __('Performance') || $sm[2] == "w3tc_dashboard") {
unset($menu[$key]);
unset( $submenu[ 'w3tc_dashboard' ] );
break;
}
}
}
}
}
add_action('admin_menu', 'ds_w3tc_remove_menu',11);
function ds_w3tc_remove_adminbar() {
global $wp_admin_bar;
if ( ! is_super_admin() ) {
$wp_admin_bar->remove_menu('w3tc');
}
}
add_action( 'admin_bar_menu','ds_w3tc_remove_adminbar',999);
?>
Try this simple code
function clean_admin_dashboard() {
if ( !is_super_admin() ) :
remove_menu_page( 'w3tc_dashboard' );
endif;
}
add_action( 'admin_init', 'clean_admin_dashboard');
function remove_admin_bar_links() {
if ( !is_super_admin() ) :
global $wp_admin_bar;
$wp_admin_bar->remove_menu('w3tc');
endif;
}
add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );
Hello, and this code works with WP 3.9 and W3T 0.9.4.? Can you explain how can I use it? or Is it secure to let the item there? Thank you!
Yes, It Does Work. I Tried It. It Works 🙂
Can you explain how can I use it?