Skip to content

Instantly share code, notes, and snippets.

@garvs
Created April 10, 2019 14:40
Show Gist options
  • Save garvs/9d70d321c9a3aebe7ada967f171833a0 to your computer and use it in GitHub Desktop.
Save garvs/9d70d321c9a3aebe7ada967f171833a0 to your computer and use it in GitHub Desktop.
This code adds additional option to the Users->User Role Editor, which allows to hide "Screen Options" link from the top of WordPress admin pages for the selected role
<?php
// Add additional option "Hide Screen Options" for every role at Users->User Role Editor
add_filter('ure_role_additional_options', 'add_hide_screen_options', 10, 1);
function add_hide_screen_options( $items ) {
$item = URE_Role_Additional_Options::create_item(
'hide_screen_options',
esc_html__('Hide Screen Options', 'user-role-editor'),
'screen_options_show_screen',
'ure_show_screen_options'
);
$items[ $item->id ] = $item;
return $items;
}
function ure_show_screen_options( $show ) {
$show = false;
return $show;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment