Site logo

Archived topic

Hide GeneratePress from Dashboard in Editor view...

20 replies · Started by Dan on May 22, 2017

Viewing posts 16–21 of 21

I've also posted a message to the Plugin developer. We'll see what they say and I'll let you know.

I had the same problems with the OP's plugin and the plugin mentioned above, you can hide/show the main Appearance sub-menu but not individual items within that sub-menu.
In the end I had to use this plugin:https://en-gb.wordpress.org/plugins/adminimize/ which seems to work well.

Thanks for letting us know! :)

Hi guys. I read through this thread while working on the same issue of giving Editors access to Appearance > Menus but nothing else in the Appearance area of WordPress. I was able to accomplish this with the following (including removing the GeneratePress menu item):

// Allow editors to see Appearance menu - This only needs to run once to update the database, so you can comment it out once editors can see the Appearance menu. If you want to stop editors seeing the Appearance menu, switch add_cap with remove_cap. Alternatively, you can use the User Role Editor plugin to provide access.
$role_object = get_role( 'editor' );
$role_object->add_cap( 'edit_theme_options' );

function hide_menu() {
	
	if (current_user_can('editor')) {
 
		// Hide theme selection page
		remove_submenu_page( 'themes.php', 'themes.php' );

		// Hide GeneratePress page
		remove_submenu_page( 'themes.php', 'generate-options' );

		// Hide widgets page
		remove_submenu_page( 'themes.php', 'widgets.php' );

		// Hide customize page
		global $submenu;
		unset($submenu['themes.php'][6]);
		
	}
}

This should work in your child theme functions.php file, or use something like the WPCode plugin to create a PHP code snippet.

Thanks for sharing!

This archived topic is closed to new replies.