skip to Main Content
Remove Core Menu Items In Dashboard

To remove unwanted items from the WordPress Dashboard that are part of the menu you can add the following code to the functions.php of your theme.

function img_remove_menus () {
 global $menu; // Make the menu variable global in scope
 $restricted = array( __('Posts'), __('Links'),__('Comments'), __('Tools'));
 end ($menu); // get final array value
 while (prev($menu)){ //check for previous value
 $value = explode(' ',$menu[key($menu)][0]);
 if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){
 unset($menu[key($menu)]); //
 }
 }
 }

add_action('admin_menu', 'img_remove_menus'); // add the action for removing the unwanted menu items

Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Back To Top