Enable Hiding Gravity Forms Menu Item

GravityForms uses the gform_full_access capability to control access to it's admin menu item. This capability as it turns out, is not assigned/enabled for any of the existing roles, including administrators.

There's a code snippet (below) that can assign this to any of the existing roles, which you can use to assign that capability to admins and editors, which are the two roles that were able to see the 'Forms' menu. You can add this using the Code Snippets Manager module.

function add_gf_cap() {
    $role = get_role( 'administrator' );
    $role->add_cap( 'gform_full_access' );

    $role = get_role( 'editor' );
    $role->add_cap( 'gform_full_access' );
}
 add_action( 'admin_init', 'add_gf_cap' );

You should then be able to see 'Administrator' and 'Editor' checkboxes in the 'Hide' options for the 'Forms' menu in Admin Menu Organizer.

If you choose to always hide the 'Forms' menu item for Editors, it is hidden as it should. You can test this using the "Utilities >> View Admin as Role" module. If you do want to test using this module instead of manually logging in as an editor, please note down the recovery URL in the module description, which will give you back admin access in the rare cases that you're logged out while viewing as a non-admin role.

Lifetime License
Available

Year-end sale!... Get 20% discount with YEAREND2024 promo code at checkout

chevron-up