[Resolved] Limit access to Theme options menu

Home Forums Support [Resolved] Limit access to Theme options menu

Home Forums Support Limit access to Theme options menu

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26078
    Ladislav Blažek

    Hi Tom,
    is there any way how to limit access to GeneratePress options menu (wp-admin/themes.php?page=generate-options) in admin area? Basically I am looking for functionality where my users are able to customize colors/fonts etc. in theme customizer but don’t have possibility to mess with addon activation.
    I was trying to achieve that with “User Role Editor” plugin but removing “edit_theme_options” rights will also remove customizer….

    #26173
    Tom
    Lead Developer
    Lead Developer

    This should do this:

    add_action('after_setup_theme','generate_hide_generatepress');
    function generate_hide_generatepress()
    {
          remove_action('admin_menu', 'generate_create_menu');
    }

    Let me know if you have any questions 🙂

    #30113
    Ladislav Blažek

    Hi Tom. Combined with condition checking ‘activate_plugins’ capability works exactly I need! Thanks a lot!

    add_action('after_setup_theme','generate_hide_generatepress');
    function generate_hide_generatepress()
    {
    	if (current_user_can('activate_plugins') == false) {
    		remove_action('admin_menu', 'generate_create_menu');
    	}
    }
    #30120
    Tom
    Lead Developer
    Lead Developer

    Awesome!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.