You can use the remove_menu_page()
hook to remove the menu items, but the pages will still be accessible if the user types in the URL. Source: WPMayor
To find the ‘contact’ page to remove, grab the slug from the Contact admin page and paste it as the argument as the argument, e.g. remove_menu_page( "[Your admin page's slug]" )
. The following ones are also slugs I believe:
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
global $user_ID;
if ( current_user_can( 'advertiser' ) ) {
remove_menu_page('tools.php'); // Tools
remove_menu_page('edit.php'); // Posts
remove_menu_page('edit-comments.php'); // Comments
}
}
Related Posts:
- How do I code access to the built-in UI of a CPT when it’s placed as submenu of another CPT that is protected by role?
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- Custom post types as sub menu pages and role capabilities issue
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Custom Post Type Settings page, choose page to display archive
- Allowing custom role access to custom post type in back end
- Put update-like notification bubble on multiple CPTs menus for pending items
- Show Custom Taxonomy Inside Custom Menu
- Remove “posts” from admin but show a custom post
- Restrict Contributors to view only their own custom post types?
- Why does my custom WP role need edit_posts to edit images?
- Defining capabilities for custom post type
- Creating custom user roles
- Can I have Post Types under other Post Types in Admin menu?
- Can I make user role that can only access a certian content type?
- How Do I Programmatically Better Organize Custom Post Type Menus?
- Is there a way to keep a custom menu expanded when editing a custom post type?
- User roles – enable custom posts disable posts
- Menu position (admin menu) of pages
- How to not allow custom roles to edit published custom post types?
- How to restrict specific post types from being read or added by specific user roles (eg. author)?
- Custom user role not working as expected
- Custom Post Type and taxonomies’s labels localization not working
- Prevent author role from editing all posts in custom post type?
- Custom Role can’t trash Custom Post Type
- How to add new tab to admin list of posts and handle result list
- Limit access to page depending on user level
- Why does current_user_can(‘edit_posts’) return true, but current_user_can(‘edit_post’, $post->ID) returns false?
- Displaying different custom post types under one admin menu
- Prevent authors from creating new posts of specific custom-post-type
- Registration and Custom Post Types – How to synchronize information?
- Limit users by custom taxonomy and user roles
- Add management screens to post type
- using add_role function to make some users to create a selected type post
- How to enable a custom post type to custom user role in WordPress
- How to remove default tag and category options form a custom post type admin menu
- Prevent custom taxonomy from being added to admin menu?
- Cannot attach media when capabilities added to custom post type
- How do increase the amount of links shown down the left in the admin menu?
- After adding add_role to functions.php and creating a user, can not login into admin
- Move custom post menu to under plugin admin menu
- How to restrict CPT post’s fronted view only for specific user roles?
- Role capability delete multiple post type posts doesn’t work
- With two custom post types, how to make one a child of the other in the admin menu?
- How to allow a custom user role to create, edit, delete a specific custom post type only?
- Define new user capability for custom post types?
- Hiding posts by other users and non-logged in
- Only view/edit/delete CPT made by users with the same role
- WordPress comments_open for specific user role or post type
- Restrict Access to Posts based on Custom User and Post Meta Data
- How to display Custom Taxonomy under Custom Admin Menu?
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- Disable user from updating certain posts
- Edit the author of custom post type
- Access to CPT but not to ‘post’ post type
- How to remove post listing page for a custom post type
- Allow add new post access to custom post but not wp post for some role
- Allow user to only access custom post type
- Ordering Submenu Pages in WP 3.1
- disable quickedit for specific custom post type user role
- Custom User role not working with custom post type
- Role capabilities issue
- Getting post attchment URL to populate a CPT Admin Page Column
- Unable to edit categories in custom post type
- How to add query args to links to CPT admin submenu
- Multiple custom post types showing up in edit.php
- Prevent user from editing others posts
- Roles and Capabilities in Custom Post Types
- How do I “trash” a custom post type post while logged in as Admin
- How to fix the Post Preview Button (CPT & map_meta_cap)
- Restrict Custom Post Type per role in Dashboard
- Restrict access to custom post type based on its taxonomy terms
- While creating a post, can I restrict the authors in the dropdown list based on their user role?
- Create relationship between custom post types and users
- How to only display all posts to a custom User Role?
- How can i redirect click to new admin page not to edit screen in post table
- Is there a way to display a custom post type menu item as “users” submenu?
- Multiple useres editing specified content
- How do you make a custom post type invisible for subscribers
- How to override post-new.php with custom template
- Setting up a page to house certain types of posts
- Capibilities of CPT WordPress
- How can I remove “Add new” button on custom post type
- Capabilities and mapping required for a role to be able to edit other’s posts of a custom type, BUT only be able to edit their own blog posts
- Changing menu label to post name for custom post type
- Custom user roles
- Editor role isn’t seeing specific post type posts with only post_type parameter
- Weird capabilities / roles behavior
- Control what custom posts a user can see
- Default taxonomy ‘post_tag’ added to CPT managing by custom role : nothing in the metabox
- Custom taxonomy archive is visible to only subscibed users
- Limit number of posts under a post type?
- Issue on CPT Custom Menu Position in WP
- Custom Taxonomy Showing in WP Menu
- Show custom taxonomies in admin panel under custom post type
- Custom role, capabilities, and post type: preview button wrecks things
- empty dashboard for custom role
- Add top-level menu pointing to a different custom post type?
- Custom post types not showing in the admin menu on production, but shows locally
- Admin menu link with variable