Make menu page link inaccessible or disabled

To do that use the following function: add_action( ‘admin_menu’, ‘custom_menu_page_removing’ ); function custom_menu_page_removing() { global $pagenow; if ( !current_user_can( ‘administrator’ ) ) { $menu = array( ‘edit.php’, ‘edit-comments.php’ ); foreach ( $menu as $main ) { remove_menu_page( $main ); } if ( in_array( $pagenow, $menu, true ) && ( !isset( $_GET[‘post_type’] ) || isset( $_GET[‘post_type’] … Read more