I found myself in a scenario today where I needed to remove the “Posts” menu item from the WordPress admin. I worked with this function to do it, so I thought I would share it here. If anyone else out there is looking for a way to remove posts from WordPress, or more specifically the posting area in the admin interface, hopefully this helps.
/**
* Cleanup Admin Menu
*
* Remove unwanted admin menu items.
*/
function cleanup_admin_menu() {
remove_menu_page( 'edit.php' );
}
add_action( 'admin_menu', 'cleanup_admin_menu' );
As with any WordPress function, drop this into your theme’s functions.php
file to make it work.