---
title: "Modifying the Default View Settings"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityview/advanced/modifying-the-default-view-settings/"
---

The `gravityview/view/settings/defaults` filter lets you customize the default settings applied to new Views. This is useful for enforcing site-wide standards like security settings, display preferences, or permissions.

## Example

```
add_filter( 'gravityview/view/settings/defaults', function( $default_settings ) {

    $default_settings['embed_only']['value'] = true;         // Prevent Direct Access
    $default_settings['is_secure']['value'] = true;          // Enable Enhanced Security
    $default_settings['page_size']['value'] = 50;            // Entries per page
    $default_settings['lightbox']['value'] = true;           // Enable lightbox for images
    $default_settings['show_only_approved']['value'] = true; // Show only approved entries
    $default_settings['caching']['value'] = true;            // Enable caching

    return $default_settings;
} );
```

```
add_filter( 'gravityview/view/settings/defaults', function( $default_settings ) {

    $default_settings['embed_only']['value'] = true;         // Prevent Direct Access
    $default_settings['is_secure']['value'] = true;          // Enable Enhanced Security
    $default_settings['page_size']['value'] = 50;            // Entries per page
    $default_settings['lightbox']['value'] = true;           // Enable lightbox for images
    $default_settings['show_only_approved']['value'] = true; // Show only approved entries
    $default_settings['caching']['value'] = true;            // Enable caching

    return $default_settings;
} );
```

These defaults apply to new Views only. Existing Views are not affected.

## Notes

### Checkbox Values

For checkbox settings, you can use either `true` /`false` or `1` /`0` :

```
$default_settings['lightbox']['value'] = true;  // Enabled
$default_settings['lightbox']['value'] = false; // Disabled

// Also valid:
$default_settings['lightbox']['value'] = 1;     // Enabled
$default_settings['lightbox']['value'] = 0;     // Disabled
```

```
$default_settings['lightbox']['value'] = true;  // Enabled
$default_settings['lightbox']['value'] = false; // Disabled

// Also valid:
$default_settings['lightbox']['value'] = 1;     // Enabled
$default_settings['lightbox']['value'] = 0;     // Disabled
```

### Settings with Dynamic Defaults

Some settings inherit their default value from global GravityView settings:

- `caching` — Inherits from GravityView Settings → Performance
- `caching_entries` — Inherits from GravityView Settings → Performance

When you set these via the filter, your value takes precedence over the global setting.

## Settings Reference

### View Settings Tab

| **Label** | **Key** | **Type** | **Default** | **Description** |

|---|---|---|---|---|
| Number of entries per page | `page_size` | number | 25 | Use -1 to display all entries. |
| Enable lightbox for images | `lightbox` | checkbox | 1 | Opens images full-size in a lightbox overlay. |
| Show only approved entries | `show_only_approved` | checkbox | 1 | Hides unapproved and disapproved entries from the View. |
| Show all entries to administrators | `admin_show_all_statuses` | checkbox | 0 | Administrators see entries with any approval status. |
| Hide View data until search is performed | `hide_until_searched` | checkbox | 0 | Only shows entries after a search is performed. |
| Search in visible fields only | `search_visible_fields` | checkbox | 0 | Limits "Search Everything" results to visible fields only. |
| Hide empty fields | `hide_empty` | checkbox | 1 | Applies to Multiple Entries layout. |
| Hide empty fields | `hide_empty_single` | checkbox | 1 | Applies to Single Entry layout. |

### No Entries Behavior

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| No Entries Behavior | `no_entries_options` | select | 0 | 0=Show Message, 1=Display Form, 2=Redirect, 3=Hide View |
| No Entries Message | `no_results_text` | text | (empty) | Message shown when no entries are visible. Supports HTML and shortcodes. |
| No Entries Form | `no_entries_form` | select | (empty) | Gravity Forms form to display when no entries exist. |
| No Entries Redirect URL | `no_entries_redirect` | text | (empty) | URL to redirect to when no entries exist. |
| "No Search Results" Text | `no_search_results_text` | text | (empty) | Message shown when a search returns no results. |

### Caching

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Enable caching | `caching` | checkbox | (plugin setting) | Improves performance. Inherits from GravityView Caching Settings. |
| Entry Cache Duration | `caching_entries` | number | (plugin setting) | Duration in seconds before cache is refreshed. |

### Single Entry Tab

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Single Entry Title | `single_title` | text | (empty) | Changes the page title when viewing a single entry. |
| Back Link Label | `back_link_label` | text | (empty) | Text for the link returning to Multiple Entries. Default: "← Go back" |

### Edit Entry Tab

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Allow User Edit | `user_edit` | checkbox | 0 | Logged-in users can edit entries they created. Admins can always edit. |
| Unapprove Entries After Edit | `unapprove_edit` | checkbox | 0 | Resets approval status to "Unapproved" after non-admin edits. |
| Redirect After Editing | `edit_redirect` | select | (empty) | (empty)=Stay, 0=Single Entry, 1=Multiple Entries, 2=URL |
| Edit Entry Redirect URL | `edit_redirect_url` | text | (empty) | Custom URL to redirect to after editing. |
| Update Button Text | `action_label_update` | text | Update | Label for the Update button. |
| Cancel Link Text | `action_label_cancel` | text | Cancel | Label for the Cancel link. |
| Enable Edit Locking | `edit_locking` | checkbox | 1 | Prevents multiple users from editing the same entry simultaneously. |

### Delete Entry Tab

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Allow User Delete | `user_delete` | checkbox | 0 | Logged-in users can delete entries they created. Admins can always delete. |
| Redirect After Deleting | `delete_redirect` | select | 1 | 1=Multiple Entries, 2=URL |
| Delete Entry Redirect URL | `delete_redirect_url` | text | (empty) | Custom URL to redirect to after deleting. |
| Delete Link Text | `action_label_delete` | text | Delete | Label for the Delete link. |

### Filter & Sort Tab

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Sort by field | `sort_field` | select | (empty) | Primary sort field. Default sorts by Entry ID. |
| Sort direction | `sort_direction` | select | ASC | ASC, DESC, or RAND (random). |
| Sort by secondary field | `sort_field_2` | select | (empty) | Secondary sort field (not available with random sort). |
| Secondary sort direction | `sort_direction_2` | select | ASC | ASC or DESC. |
| Enable sorting by column | `sort_columns` | checkbox | 0 | Allows users to click column headers to sort (Table layout only). |
| Filter by Start Date | `start_date` | text | (empty) | Show entries after this date. Supports relative dates like "-1 week". |
| Filter by End Date | `end_date` | text | (empty) | Show entries before this date. Supports relative dates like "now". |

### Permissions Tab

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Prevent Direct Access | `embed_only` | checkbox | (empty) | Only allows access when View is embedded via shortcode or block. |
| Enable Enhanced Security | `is_secure` | checkbox | 0 | Requires `secret` attribute on shortcodes/blocks. |
| Allow User Duplicate | `user_duplicate` | checkbox | 0 | Logged-in users can duplicate entries they created. |
| Allow REST Access | `rest_enable` | checkbox | (empty) | Enables REST API access to this View. |
| Allow Export | `csv_enable` | checkbox | (empty) | Users can download data by adding /csv/ or /tsv/ to the View URL. |
| Show All In File | `csv_nolimit` | checkbox | (empty) | Export all entries without pagination limit. |

### Custom Code Tab

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Custom CSS | `custom_css` | textarea | (empty) | CSS placed in page head, after GravityView styles. |
| Custom JavaScript | `custom_javascript` | textarea | (empty) | JavaScript placed in page footer, after GravityView scripts. |

## Extension Settings

These settings are available when the corresponding extension is active.

### Advanced Filter

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Show only entries created by the currently logged-in user | `show_only_entries_by_current_user` | checkbox | 0 | Shortcut for an Advanced Filter condition. |

### Multiple Forms

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Show only approved joined entries | `show_only_approved_joined` | checkbox | 0 | Hides unapproved/disapproved joined entries. |
| Strict Entry Match | `multiple_forms_disable_null_joins` | checkbox | 0 | Only returns entries with matches in connected forms. |

### Magic Links

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Enable Magic Links | `magic_link_enable` | checkbox | 0 | Allows editing entries via secure magic links. |
| Allow Deletion via Magic Link | `magic_link_delete` | checkbox | 0 | Users can delete entries via magic link without logging in. |
| Email Field | `magic_link_email_field` | select | 0 | Email field used for validation. |
| Allowed Emails | `magic_link_allowed_emails` | textarea | (empty) | Email addresses with edit access. Supports wildcards like \*@example.com. |
| Edit Window | `magic_link_edit_window` | select | (varies) | How long after entry creation editing is allowed. [See available options](https://www.gravitykit.com/docs/gravityview-pro/magic-links/magic-links-filters/#:~:text=Additional%20customization). |
| Link Expiration | `magic_link_expiration` | select | (varies) | How long magic links remain valid after being sent. [See available options](https://www.gravitykit.com/docs/gravityview-pro/magic-links/magic-links-filters/#:~:text=Additional%20customization). |
| One-Time Access | `magic_link_one_time_access` | checkbox | 0 | Invalidates links after first use. |

### GravityEdit

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Enable Inline Edit | `gk_inline_edit_enable` | checkbox | 0 | Adds a link to toggle inline editing capabilities on the View. |

### GravityMath

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Calculation Row Background | `gv_math_footer_row_background_color` | color | \#f0f0f0 | Background color for the calculation row. |
| Calculation Row Position | `gv_math_footer_row_position` | select | below | "below" or "above" the table footer. |

### Dashboard Views

| **Label** | **Key** | **Type** | **Default** | **Description** |
|---|---|---|---|---|
| Show in Dashboard | `dashboard_views_enable` | checkbox | 0 | Makes the View accessible in WordPress Dashboard. |
| Restrict to Internal-Only View | `dashboard_views_internal_only` | checkbox | 0 | Prevents the View from rendering on the frontend. |
| Limit Access to User Role(s) | `dashboard_views_user_roles` | custom | (empty) | Restricts View to selected roles. Admins always have access. |

## More Examples

### Security-Focused

```
add_filter( 'gravityview/view/settings/defaults', function( $settings ) {

    $settings['embed_only']['value'] = true;
    $settings['is_secure']['value'] = true;
    $settings['rest_enable']['value'] = false;
    $settings['csv_enable']['value'] = false;

    return $settings;
} );
```

```
add_filter( 'gravityview/view/settings/defaults', function( $settings ) {

    $settings['embed_only']['value'] = true;
    $settings['is_secure']['value'] = true;
    $settings['rest_enable']['value'] = false;
    $settings['csv_enable']['value'] = false;

    return $settings;
} );
```

### User Portal

```
add_filter( 'gravityview/view/settings/defaults', function( $settings ) {

    // Requires Advanced Filter extension
    $settings['show_only_entries_by_current_user']['value'] = true;
    $settings['user_edit']['value'] = true;
    $settings['user_delete']['value'] = true;

    return $settings;
} );
```

```
add_filter( 'gravityview/view/settings/defaults', function( $settings ) {

    // Requires Advanced Filter extension
    $settings['show_only_entries_by_current_user']['value'] = true;
    $settings['user_edit']['value'] = true;
    $settings['user_delete']['value'] = true;

    return $settings;
} );
```

### Agency / Multi-Site

```
add_filter( 'gravityview/view/settings/defaults', function( $settings ) {

    // Performance
    $settings['caching']['value'] = true;

    // Display
    $settings['page_size']['value'] = 50;
    $settings['lightbox']['value'] = true;
    $settings['hide_empty']['value'] = true;
    $settings['hide_empty_single']['value'] = true;

    // Sort by newest first
    $settings['sort_field']['value'] = 'date_created';
    $settings['sort_direction']['value'] = 'DESC';

    return $settings;
} );
```

```
add_filter( 'gravityview/view/settings/defaults', function( $settings ) {

    // Performance
    $settings['caching']['value'] = true;

    // Display
    $settings['page_size']['value'] = 50;
    $settings['lightbox']['value'] = true;
    $settings['hide_empty']['value'] = true;
    $settings['hide_empty_single']['value'] = true;

    // Sort by newest first
    $settings['sort_field']['value'] = 'date_created';
    $settings['sort_direction']['value'] = 'DESC';

    return $settings;
} );
```

## Related

- [Where to Put Code Samples](https://www.gravitykit.com/docs/gravityview/customizing-your-views/where-to-put-code-samples/)
- [The View Settings Meta Box](https://www.gravitykit.com/docs/gravityview/getting-started-gravityview/the-view-settings-meta-box/)

- [How GravityView Security Works](https://www.gravitykit.com/docs/gravityview/advanced/how-gravityview-security-works/)