Skip to content

Instantly share code, notes, and snippets.

@landbryo
Last active September 11, 2018 16:59
Show Gist options
  • Save landbryo/291584ce8608e65ccba2406b0ba0e85d to your computer and use it in GitHub Desktop.
Save landbryo/291584ce8608e65ccba2406b0ba0e85d to your computer and use it in GitHub Desktop.
Grant editor role full access to Gravity Forms
/* These functions are set to run on init and can be removed after they've run once. There is no need to keep them in the functions file */
/* Credit goes to https://ryanbenhase.com/giving-editors-access-to-gravity-forms/ */
//////////////////
// GRANT ACCESS //
//////////////////
function grant_gforms_editor_access() {
$role = get_role( 'editor' );
$role->add_cap( 'gform_full_access' );
}
add_action( 'init', 'grant_gforms_editor_access' );
///////////////////
// REVOKE ACCESS //
///////////////////
function revoke_gforms_editor_access() {
$role = get_role( 'editor' );
$role->remove_cap( 'gform_full_access' );
}
add_action( 'init', 'revoke_gforms_editor_access' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment