Changing the default View settings
The gravityview/view/settings/defaults filter changes the settings a new View starts with, such as the number of entries per page or Prevent Direct Access. Use it when most of your Views need the same settings, so you don’t have to change them on each new View.
Setting your own defaults #
This snippet starts each new View with 50 entries per page, and with Prevent Direct Access and Allow User Edit turned on:
/**
* Changes the settings new Views start with.
*
* Priority 20 runs after features and add-ons add their settings.
*
* @param array $settings Every View setting, keyed by its name.
*
* @return array The settings with your defaults.
*/
add_filter( 'gravityview/view/settings/defaults', function ( $settings ) {
$settings['page_size']['value'] = 50; // Number of entries per page
$settings['embed_only']['value'] = 1; // Prevent Direct Access
$settings['user_edit']['value'] = 1; // Allow User Edit
return $settings;
}, 20 );Note: Adding custom PHP code snippets to your website explains where this code goes.
The filter gets every View setting keyed by its name, apart from the settings on the DataTables and Live Filters tabs. Each setting is an array whose value is the default. The tables at the end of this page list the keys of the settings the Settings box shows, tab by tab, except the sort fields on the Filter & Sort tab.
A new View shows your values in its Settings box, and you can still change them on that View. With this snippet, the Multiple Entries tab of a new View starts with 50 in Number of entries per page:

Use priority 20, as the snippet does. GravityView Pro’s features and add-ons such as GravityEdit and GravityMath add their settings through the same filter at priority 10 or 11, and so do Mark Entry As Read and Entry Slug. If your function runs before them, they replace the values you set for those settings.
For a checkbox, use 1 or true to turn it on, and 0 or false to turn it off. For a drop-down, use the value the tables give for the choice you want, such as 3 for Hide the View under No Entries Behavior. Numbers and text go in as they are.
Which Views use your defaults #
Your defaults apply to the Views you create after adding the snippet. A View you already have keeps every setting it was saved with, unchecked boxes included.
A View can also be missing a setting, such as a Magic Links setting on a View last saved before Magic Links was turned on. The View uses your default for that setting straight away, and clicking Update in its editor saves the value.
Settings the View editor never saves, such as offset and class, take your default on every View. A default for one of them changes the Views you already have.
Settings that start from somewhere else #
A few settings don’t take their starting value from this filter alone. GravityView’s own settings are in the WordPress menu under GravityKit, then Settings, then GravityView.
- Enable Enhanced Security (
is_secure) is on in every new View, whatever your default says. - Theme (
theme) comes from Default theme in the Appearance section of GravityView’s settings. Your default doesn’t change the theme of new Views. - Enable caching (
caching) and Entry Cache Duration (caching_entries) start with the values in the Caching section of GravityView’s settings. A default you set replaces them. - Allow REST Access (
rest_enable) is on the Permissions tab while REST API is off in GravityView’s settings. - Prevent REST Access (
rest_disable) takes its place while REST API is on. - Show only approved joined entries (
show_only_approved_joined), from Multiple Forms, is checked in every new View, whatever your default says. - Show only entries created by the currently logged-in user (
show_only_entries_by_current_user), from Advanced Filtering, adds or removes a condition in the View’s Advanced Filter. A new View starts with no conditions, so a default for it has no effect.
Defaults for a built-in feature’s settings #
This snippet turns on Magic Links in every new View and makes the links it sends work for 2 hours:
/**
* Turns on Magic Links in new Views, with links that work for 2 hours.
*
* Priority 20 runs after Magic Links adds its settings.
*
* @param array $settings Every View setting, keyed by its name.
*
* @return array The settings with your defaults.
*/
add_filter( 'gravityview/view/settings/defaults', function ( $settings ) {
$settings['magic_link_enable']['value'] = 1;
$settings['magic_link_expiration']['value'] = 2 * HOUR_IN_SECONDS;
return $settings;
}, 20 );Note: Adding custom PHP code snippets to your website explains where this code goes.
Until a new View is saved, its Magic Links tab says “Please select a form first.” After the first save, the tab shows these values, and clicking Update saves them with the View.
Replacing an older snippet #
Older snippets use the gravityview_default_args filter. It still works, but it is deprecated, and while WP_DEBUG is on, GravityView shows a notice about it on the WordPress Dashboard.
To update an older snippet, rename the filter to gravityview/view/settings/defaults and keep the callback as it is. Deprecated and renamed hooks lists every renamed GravityView hook.
Some older snippets change the number of entries per page with gravityview_default_page_size. That filter doesn’t change new Views, which still start with 25 in Number of entries per page, so set page_size with this filter instead, as in the first snippet.
Settings reference #
Each table covers one tab of a View’s Settings box, in the order the tab shows its settings. Default is the value a new View starts with when no snippet changes it.
View Settings tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable lightbox for images | lightbox | On | Opens images full size in a lightbox. |
| Show only approved entries | show_only_approved | On | Hides unapproved and disapproved entries. |
| Show all entries to administrators | admin_show_all_statuses | Off | Administrators see entries of every approval status. Shown while Show only approved entries is on. |
| Search in visible fields only | search_visible_fields | Off | Limits Search Everything to the fields the View shows. |
| Enable caching | caching | Enable Caching in GravityView’s settings, on unless changed | |
| Entry Cache Duration | caching_entries | Entry Cache Duration in GravityView’s settings, 86400 unless changed | In seconds. Shown while Enable caching is on. |
Styles tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Theme | theme | Default theme in GravityView’s settings, Vantage unless changed | vantage or legacy. |
| Grid Columns | grid_columns | 1 | Cards per row, from 1 to 6, on layouts other than Table. Hidden while Theme is Legacy. |
| Grid Gap | grid_gap | 24 | Space between cards, in pixels. The Settings box doesn’t show it, so only code sets it. |
| Card Minimum Width | card_min_width | 0 | How narrow a card can get before the grid wraps, such as 280px. The Settings box doesn’t show it, so only code sets it. |
| Equal Height | card_equal_height | On | Makes the cards in a row as tall as the tallest one. |
Multiple Entries tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Number of entries per page | page_size | 25 | -1 shows every entry. |
| Hide View data until search is performed | hide_until_searched | Off | |
| Hide empty fields | hide_empty | On | |
| No Entries Behavior | no_entries_options | 0 | 0 Show a Message, 1 Display a Form, 2 Redirect to URL, 3 Hide the View. |
| No Entries Message | no_results_text | Empty | HTML and shortcodes work here. |
| No Entries Form | no_entries_form | Empty | A form ID. |
| Form Title | no_entries_form_title | On | Shows the title of the No Entries Form. |
| Form Description | no_entries_form_description | On | Shows the description of the No Entries Form. |
| No Entries Redirect URL | no_entries_redirect | Empty | |
| “No Search Results” Text | no_search_results_text | Empty |
Single Entry tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Single Entry Title | single_title | Empty | The page title on an entry’s page. |
| Back Link Label | back_link_label | Empty | The text of the link back to the Multiple Entries page. |
| Hide empty fields | hide_empty_single | On | |
| Mark Entry As Read | mark_entry_as_read | On | Marks an entry as read when someone who can edit entries opens its page. |
| Entry Slug | single_entry_slug | Empty | Include {entry_id} so that no two entries get the same address. |
Edit Entry tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable Edit Locking | edit_locking | On | Stops two users from editing the same entry at once. |
| Request Control Check Frequency | edit_locking_check_interval | 10 | In seconds. |
| Allow User Edit | user_edit | Off | Logged-in users can edit the entries they created. |
| Unapprove Entries After Edit | unapprove_edit | Off | |
| Redirect After Editing | edit_redirect | Empty | Empty for Stay on Edit Entry, 0 Redirect to Single Entry, 1 Redirect to Multiple Entries, 2 Redirect to URL. |
| Edit Entry Redirect URL | edit_redirect_url | Empty | |
| Edit Entry Title | edit_entry_title | Empty | Merge tags work here. |
| Use as Page Title | edit_entry_page_title | On | |
| Update Button Text | action_label_update | Update | |
| Cancel Link Action | edit_cancel_lightbox_action | close_lightbox | Or redirect_to_single_entry, for editing in a lightbox. |
| Next Page Button Text | action_label_next | Next | For multi-page forms. |
| Previous Page Button Text | action_label_previous | Previous | For multi-page forms. |
| Cancel Link Text | action_label_cancel | Cancel | |
| Delete Link Text | action_label_delete | Delete | |
| Edit Window | edit_window_enabled | Off | This is a separate setting from Edit Window on the Magic Links tab (magic_link_edit_window). |
| Closing rules | edit_window_logic | standard | standard or custom. |
| Close the edit window | edit_window_mode | after_submission | form_schedule, after_submission, date, date_field or never. |
| Time after submission | edit_window_amount | 24 | |
| Time unit | edit_window_unit | hours | hours, days or weeks. |
| Deadline date | edit_window_date | Empty | A date, such as 2026-12-31. |
| Deadline Date field | edit_window_field | 0 | A field ID. |
| Close relative to the date | edit_window_relation | on | on, before or after. |
| Days before or after | edit_window_offset | 0 | |
| Closing time | edit_window_time | 23:59:59 | |
| When the date is empty | edit_window_empty_date | closed | closed or open. |
| Also apply to deleting entries | edit_window_delete | Off | |
| Message when the window is closed | edit_window_message | Empty |
Delete Entry tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Allow User Delete | user_delete | Off | Logged-in users can delete the entries they created. |
| Redirect After Deleting | delete_redirect | 1 | 1 Redirect to Multiple Entries, 2 Redirect to URL. |
| Delete Entry Redirect URL | delete_redirect_url | Empty |
Filter & Sort tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable sorting by column | sort_columns | Off | |
| Filter by Start Date | start_date | Empty | A date, or a relative date such as -1 week. |
| Filter by End Date | end_date | Empty | A date, or a relative date such as now. |
| Allow searching beyond the start and end date range | allow_date_range_overwrite | Off |
Permissions tab
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable Enhanced Security | is_secure | On | A default here doesn’t change this. |
| Prevent Direct Access | embed_only | Off | |
| Allow User Duplicate | user_duplicate | Off | |
| Allow REST Access | rest_enable | Off | Shown while REST API is off in GravityView’s settings. |
| Prevent REST Access | rest_disable | Off | Shown while REST API is on in GravityView’s settings. |
| Allow Export | csv_enable | Off | Lets visitors download entries by adding /csv/ or /tsv/ to the View’s URL. |
| Show All In File | csv_nolimit | Off |
Custom Code tab
| Setting | Key | Default |
|---|---|---|
| Custom CSS | custom_css | Empty |
| Custom JavaScript | custom_javascript | Empty |
Settings of built-in features and add-ons #
Advanced Filtering, Multiple Forms, Magic Links, Dashboard Views, Ratings & Reviews, Featured Entries and Maps are built into GravityView Pro. Their settings exist while the feature is on. To turn a feature on or off, go to Plugins and click Features in the GravityView Pro row.
GravityEdit and GravityMath are separate plugins, so their settings exist while the plugin is active. Set every setting in this section at priority 20, as in the Magic Links example.
Advanced Filtering
| Setting | Key | Default | Notes |
|---|---|---|---|
| Show only entries created by the currently logged-in user | show_only_entries_by_current_user | Off | On the View Settings tab. A default here has no effect. |
GravityEdit
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable Inline Edit | inline_edit | Off | On the View Settings tab. Adds a link that turns inline editing on and off. |
GravityMath
| Setting | Key | Default | Notes |
|---|---|---|---|
| Calculation Row Background | gv_math_footer_row_background_color | #f0f0f0 | On the Multiple Entries tab. |
| Calculation Row Position | gv_math_footer_row_position | below | below or above the table footer. |
Multiple Forms
| Setting | Key | Default | Notes |
|---|---|---|---|
| Show only approved joined entries | show_only_approved_joined | On | On the View Settings tab, while Show only approved entries is on. A default here doesn’t change this. |
| Strict Entry Match | multiple_forms_disable_null_joins | Off | Shows only the entries that have a match in the joined forms. |
Magic Links
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable Magic Links | magic_link_enable | Off | |
| Allow Entry Deletion | magic_link_delete | Off | |
| Email Field | magic_link_email_field | 0 | A field ID. 0 is Don’t validate by email field, so only the addresses in Allowed Emails can get a link. |
| Allowed Emails | magic_link_allowed_emails | Empty | Addresses separated by commas or new lines. *@example.com allows a whole domain. |
| Link Expiration | magic_link_expiration | 900 | A link works for this many seconds, from 300 (5 minutes) to 43200 (12 hours). The default is 15 minutes. Adding longer Link Expiration choices adds more. |
| One-Time Access | magic_link_one_time_access | Off | A link stops working after its first use. |
| Edit Window | magic_link_edit_window | 172800 | An entry can be edited for this many seconds after it’s created, from 0 (No time limit) to 63072000 (2 years). The default is 2 days. This is a separate setting from the Edit Window section on the Edit Entry tab. |
Dashboard Views
| Setting | Key | Default | Notes |
|---|---|---|---|
| Show in Dashboard | dashboard_views_enable | Off | |
| Restrict to Internal-Only View | dashboard_views_internal_only | Off | The View never shows on the front end. |
| Limit Access to User Role(s) | dashboard_views_user_roles | Empty | A list of role names, such as array( 'editor' ). Administrators always have access. |
| Customize the Menu Link | dashboard_views_custom_name | Empty | The View’s name in the Dashboard menu. Empty uses the View’s title. |
Ratings & Reviews
Ratings & Reviews starts turned off. Its settings are on the Ratings & Reviews tab.
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable entry reviews | allow_entry_reviews | Off | |
| Review type | entry_review_type | stars | stars for 5-Star Rating, vote for Vote. |
| Disable downvoting | disable_downvoting | Off | |
| Require ratings | rating_required | Off | |
| Limit to one review per person per entry | limit_one_review_per_person | On | |
| Hide “Rate” field from the form | hide_ratings | Off | |
| Hide “Title” and “Review” fields from the form | hide_title_and_desc | Off | |
| Allow empty review text | allow_empty_reviews | Off | |
| Allow users to edit their reviews | allow_reviews_edit | Off | |
| Reviews edit duration | allow_reviews_edit_duration | 3600 | In seconds. 0 sets no limit. |
| Show reviewer Gravatar | show_gravatar_for_review | Off |
Featured Entries
| Setting | Key | Default | Notes |
|---|---|---|---|
| Move Featured Entries to Top | featured_entries_to_top | Off | On the View Settings tab. |
Maps
This table lists the settings on the Maps tab, plus Show geocoding map from the Edit Entry tab.
| Setting | Key | Default |
|---|---|---|
| Address Fields | map_address_field | Empty |
| Enable automatic geocoding | map_auto_geocode | Off |
| Default Marker Icon | map_marker_icon | The Maps default pin |
| Choice-Based Marker Icon | choice_marker_icon_field | Empty |
| Map Position | map_canvas_position | top, or right, bottom, or left |
| Keep the map fixed during page scroll | map_canvas_sticky | On |
| Enable 3D map types | map_enable_3d | Off |
| Map Type | map_type | roadmap, or satellite, hybrid, terrain, satellite_3d, or hybrid_3d |
| Starting View | map_3d_default_mode | 3d, or 2d or 2d_map |
| Minimum Zoom for 3D | map_3d_min_zoom | 0 |
| Enable info boxes | map_info_enable | Off |
| Title | map_info_title | Empty |
| Convert the info box “Title” into a link to the single entry | map_info_title_link | On |
| Content | map_info_content | Empty |
| Image URL | map_info_image | Empty |
| Image Alignment | map_info_image_align | 0 (Top), or left or right |
| Default Radius | map_default_radius_search | 15 |
| Default Radius Unit | map_default_radius_search_unit | mi when the site language is English (United States), English (UK), or Burmese, otherwise km |
| Only show Default Radius Unit | map_default_radius_search_unit_only | Off |
| Immediately request a user’s location to trigger a radius search | map_automatic_radius_search | Off |
| Hide radius search circle | map_hide_radius_circle | Off |
| Sort radius search results by distance | map_enable_radius_distance_sort | Off |
| Map Layers | map_layers | 0 (None), or traffic, transit, or bicycling |
| Default Zoom | map_zoom | 15 |
| Maximum Zoom | map_maxzoom | 16 |
| Minimum Zoom | map_minzoom | 3 |
| Zoom Control | map_zoom_control | default, or small or none |
| Allow the map to be dragged | map_draggable | On |
| Allow double-clicking on the map to zoom and center | map_doubleclick_zoom | On |
| Allow scrolling to zoom in and out on the map | map_scrollwheel_zoom | On |
| Display the “Pan” control that allows moving the map by clicking arrows | map_pan_control | On |
| Display the Street View “Pegman” control | map_streetview_control | On |
| Custom Map Styles | map_styles | Empty |
| Group nearby markers together when displaying map beyond a certain zoom level | map_marker_clustering | Off |
| Clustering Maximum Zoom | map_marker_clustering_maxzoom | 12 |
| International Autocomplete Filter | map_international_autocomplete_filter | Empty |
| Geocoding Source | map_geocode_source | internal, or gravity_wiz or gravity_forms |
| Show geocoding map | map_edit_entry_geocoding | Off |