Snippi
A super awesome snippet tool.
- 1.
<?php
- 2.
- 3.
add_action( ‘admin_menu’, ‘my_remove_menus’, 999 );
- 4.
- 5.
function my_remove_menus() {
- 6.
- 7.
/* create an array of user ids to remove the menu from */
- 8.
$my_user_ids = array( 14, 15, 16 );
- 9.
- 10.
/* check whether the current user id exists in the above array */
- 11.
if( in_array( get_current_user_id(), $my_user_ids ) ) {
- 12.
- 13.
/* id matches the array so remove the menu */
- 14.
remove_menu_page( ‘link-manager.php’ );
- 15.
- 16.
}
- 17.
}
- 18.
?>