---
title: "How to restrict access to Import Entries"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityimport/how-to-restrict-access-to-import-entries/"
---

![Screenshot of the Import/Export page of Gravity Forms](https://www.gravitykit.com/wp-content/uploads/2025/10/file-aVN46EmSnP.png)
*It's easy to give access to a custom user role to import entries*[by adding some capabilities](https://www.gravitykit.com/docs/gravityimport/capabilities-necessary-to-import-entries/) to that role. But if you want to restrict access to the Import Entries tab in the Import/Export page of Gravity Forms, then you'll need to use the code snippet below.

```
/**
 * Remove the ability of a user to import entries based on their role.
 *
 * @param array $caps Array of capabilities required to display the UI.
 *
 * @return array
 */
add_filter( 'gravityview/import/capabilities', function ( $caps ) {

    // REPLACE THIS with the role you want to exclude from importing entries.
    $role = 'editor';

    $user = wp_get_current_user();

    if ( ! $user || ! $user->exists() ) {
        return [];
    }

    if ( in_array( $role, $user->roles, true ) ) {
        return [];
    }

    return $caps;
} );
```

```
/**
 * Remove the ability of a user to import entries based on their role.
 *
 * @param array $caps Array of capabilities required to display the UI.
 *
 * @return array
 */
add_filter( 'gravityview/import/capabilities', function ( $caps ) {

    // REPLACE THIS with the role you want to exclude from importing entries.
    $role = 'editor';

    $user = wp_get_current_user();

    if ( ! $user || ! $user->exists() ) {
        return [];
    }

    if ( in_array( $role, $user->roles, true ) ) {
        return [];
    }

    return $caps;
} );
```

See how to add this code snippet to your website: [Where to put code samples](https://www.gravitykit.com/docs/gravityview/customizing-your-views/where-to-put-code-samples/).