I am trying to remove some menu-links capabilities from the wp-admin for a user role called wsm. I have tried many ways and when i just add the code below it will remove those links from the menu for all user roles.
The problem is that it also strips the menus from my own admin as Super Admin. So basically it removes the menu links from any role.
I tried to add this line: { if (current_user_can('administrator')) but it didn't change anything. Maybe i added it in the wrong place?
I need to remove links also based on certain post types as you can see below.
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
function remove_row_actions_testimonials( $actions )
{
if( get_post_type() === 'wiki-testimonials' )
unset( $actions['view'] );
unset( $actions['edit'] );
return $actions;
}
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
function remove_row_actions_staff( $actions )
{
if( get_post_type() === 'wiki-staff' )
unset( $actions['view'] );
unset( $actions['delete'] );
unset( $actions['trash'] );
unset( $actions['edit'] );
return $actions;
}
If someone can help me to produce the correct solution I would be very greatfull. Thanks in advance.