Remove Media Menu in WordPress easily.

While working on a custom QA project I came across some interesting code on the site audit.
Why this would be done? Not sure!

If you ever want to remove your media menu just ad this code to your function.php file.

Or if you can’t find your media menu, then most likely you have this code somewhere in your site.

Remember it also removes – Dashboard – Post – Comments and Tools

// Remove menus
function remove_menus() {
global $menu;
$restricted = array(
__(‘Dashboard’),
__(‘Posts’),
__(‘Media’),
__(‘Comments’),
__(‘Tools’)
);
end ($menu);

while (prev($menu)) {
$value = explode(‘ ‘, $menu[key($menu)][0]);
if (in_array($value[0] != NULL?$value[0]:”” , $restricted)) {
unset($menu[key($menu)]);
}
}
}
add_action(‘admin_menu’, ‘remove_menus’);

// Menus