Not everyone who logs into the site backend needs access to every available admin menu items.
It can cause several problems for a person who does not understand. To reduce such cases add the snippet to your function.php file in your child theme.

function wps_remove_admin_menu_items_for_user() {

// Here you can change the 'administrator' role to your desired role 
   if( current_user_can( 'administrator' ) ){

       remove_menu_page( 'edit.php?post_type=page' );    


add_action('admin_menu', 'wps_remove_admin_menu_items_for_user' );

In the above function first, we are checking the current user role.

However, if it matches the condition then with the help of remove_menu_page we are removing the page menu. Here you can add any desired post type.

Leave a Comment

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

Scroll to Top