Site icon Hip-Hop Website Design and Development

Eradicating add new pages kind editor function

Hello I’ve arrange multisite and I’m the tremendous admin. I wish to take away the capabilities of “Editors” so as to add new pages. I made this variation to my theme operate, which eliminated what I need it too, nevertheless it additionally removes the button and submenu my Admin consumer. I’ve tried to place in an if situation, however not having a lot luck!

//conceal Web page
operate hide_buttons()
{
international $current_screen;

if($current_screen->id == 'web page');
{
echo '<fashion>.add-new-h2, a.page-title-action {show: none;}</fashion>';

}

!current_user_can('publish_posts'))
}
add_action('admin_head','hide_buttons'); // removes the "add new" button on Pages web page.


if( current_user_can('editor') ) {

add_action( 'admin_menu', operate () {
remove_submenu_page( 'edit.php?post_type=web page', 'post-new.php post_type=web page' );  //removes the sub web page "add new" in Admin facet bar for editor
}, 999);

}