Created
June 27, 2018 14:02
-
-
Save kylephillips/4e86f8e5cf991bbbc0e6d5651c5b68f3 to your computer and use it in GitHub Desktop.
Hide the "Add Multiple" buttons from non-administrators in Nested Pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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