Skip to content

Instantly share code, notes, and snippets.

@kylephillips
Created June 27, 2018 14:02
Show Gist options
  • Save kylephillips/4e86f8e5cf991bbbc0e6d5651c5b68f3 to your computer and use it in GitHub Desktop.
Save kylephillips/4e86f8e5cf991bbbc0e6d5651c5b68f3 to your computer and use it in GitHub Desktop.
Hide the "Add Multiple" buttons from non-administrators in Nested Pages
/**
* Place in your theme's functions.php
*/
add_action('admin_head', 'hide_nested_pages_add_multiple');
function hide_nested_pages_add_multiple()
{
$user = wp_get_current_user();
$allowed_roles = ['administrator'];
if ( array_intersect($allowed_roles, $user->roles) ) return;
echo '<style>.open-bulk-modal, .nestedpages .action-buttons .nestedpages-dropdown ul li a.add-new-child, .nestedpages .action-buttons .nestedpages-dropdown ul li:nth-child(2) {display:none;}</style>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment