Gravity Forms – function to allow administrators to view inactive forms

The following code will allow Adminstrators and users that have access to view form submissions to view a form when the form has been marked as ‘inactive’.

You can use the code by adding it to your theme’s functions.php file (anywhere after the opening <?php line).

Please note, this requires Gravity Forms 1.9 or above.

add_filter('gform_form_args', function ($args) {
    if (is_user_logged_in() && (current_user_can('manage_options' ) || current_user_can('gravityforms_view_entries'))) {
        $args['force_display'] = true;
        
    }
    return $args;
    }
);