Hiding admin menu buttons in WordPress

Hiding individual admin buttons in WordPress backend is really easy.

WordPress ease of use and administration interface is probably second to none. Almost everyone who has deployed WordPress to a new client has instructed them to avoid certain menu items and settings interface as they could potentially break the site.

A better solution is to hide the menu items.

This tip shows you how to use WordPress API functions, introduced in version 3.1, to remove the Links editor and Permalinks settings menu items. Note this technique only hides the menu item, it does not remove the URL so anyone with the correct permissions can still access the menu item through the URL.

add_action( 'admin_menu', 'my_hide_menu_item' );

    // Remove the "Posts" menu item"
    remove_menu_page( 'post.php' );

    // And to remove sub menu items use
    remove_submenu_page( 'options-general.php',
         'options-permalink.php' );
}

The trick is to hover over the menu item that you want to remove, see which php file is redirects to and then remove it using the above function.

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments

Copywrite © 2017 Kevin Phillips All rights are reserved.

Proudly supporting opensource software