- This topic has 10 replies, 5 voices, and was last updated 4 years, 4 months ago by
Elvin.
-
AuthorPosts
-
July 2, 2020 at 10:33 pm #1350149
gregoirenoyelle
Hi !
Is-there a way to hide some GeneratePress’s customizer options for a specific role?
I know how to use thecurrent_user_can
condition. I don’t want to use a plugin for that.
I find this link: Remove all GP Customizer options. Is there the all list here?
Thanks 🙂July 3, 2020 at 9:37 am #1350842Tom
Lead DeveloperLead DeveloperThat function is likely your best bet, although it is subject to change (if we re-organize etc..), so keep an eye on it.
Let me know if you run into any issues 🙂
July 3, 2020 at 9:54 am #1350857gregoirenoyelle
Hi Tom,
OK thanks. I will test and I will add an example for the others.July 3, 2020 at 2:31 pm #1351061Tom
Lead DeveloperLead DeveloperThanks!
January 9, 2021 at 4:27 pm #1612619Ismael
@gregoirenoyelle, ever got your code to work? I’m currently searching for the same thing.
Show and hide customizer Panels, sections and settings based on user role.
Thanks
January 9, 2021 at 4:56 pm #1612646Ismael
I just figured out, Thanks.
January 10, 2021 at 11:07 pm #1613906gregoirenoyelle
Ok @Ismael . Great
April 28, 2021 at 12:37 pm #1754041Omar
I ran into this ticket as I was trying to give my editor user the ability to add menus, without having access to the full “Appearance”. I found the below code, and have managed to hide everything I need to hide except for the Generate Options Page.
/* Give Editor Appearance Edit Privilege */ function add_theme_caps() { $role_object = get_role( 'editor' ); $role_object->add_cap( 'edit_theme_options' ); } add_action( 'admin_init', 'add_theme_caps'); /* Hide Appearance Submenus Except Menu Page */ function hide_menu() { if (current_user_can('editor')) { remove_submenu_page( 'themes.php', 'themes.php' ); // hide the theme selection submenu remove_submenu_page( 'themes.php', 'themes.php?page=generate-options' ); // hide theme options remove_submenu_page( 'themes.php', 'widgets.php' ); // hide the widgets submenu remove_submenu_page( 'themes.php', 'customize.php' ); // hide the customizer submenu remove_submenu_page( 'themes.php', 'customize.php?return=%2Fwp-admin%2F' ); // hide the customizer submenu } } add_action('admin_head', 'hide_menu');
This line below isn’t doing the trick and I would like to know if there is a way to resolve that.
remove_submenu_page( 'themes.php', 'themes.php?page=generate-options' ); // hide theme options
Thanks!
April 28, 2021 at 11:27 pm #1754634Elvin
StaffCustomer SupportHi Omar,
For one, I think the best way to deal with it is with this filter:
https://docs.generatepress.com/article/generate_dashboard_page_capability/May 3, 2021 at 6:01 am #1761775Omar
That very was helpful, Thanks!
May 3, 2021 at 4:55 pm #1762739Elvin
StaffCustomer SupportNo problem. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.