Gravity Forms – function to allow administrators to view inactive forms

When a form is marked as ‘inactive’ in Gravity Forms the form cannot be loaded in the front end.

The following code will allow administrators and users that have access to view form entries to view ‘inactive’ forms.

This may be useful if you need to review an version of a form without making it publicly available.

Please note, this requires Gravity Forms 1.9 or above and is currently limited to single page forms (multi-page navigation does not work for inactive forms).

If you’re not sure where to place this code I highly recommend you read How to create a WordPress plugin for your custom functions.

add_filter( 'gform_form_args', 'administrator_view_inactive_form', 10, 1 );

function administrator_view_inactive_form( $args ) {
    if ( current_user_can( 'manage_options' ) || current_user_can( 'gravityforms_view_entries' ) ) {
        $args['force_display'] = true;
    }
    return $args;
}