All documentation
Reference
Filtering
Date ranges, multi-select, range sliders, global search, and per-user filtering.
Gravity Tables ships five filter primitives: per-user filtering, column filters, hard-coded filters, global search, and shortcode-driven sort.
filter_by_user#
The most common filter pattern. Each logged-in user sees only entries where created_by matches their user ID.
[gravity_table id="42" filter_by_user="true"]
This filter:
- Runs at the database query layer (unauthorised users never receive the data)
- Composes with role-based visibility (
allowed_roles) - Defaults to “log in to see your submissions” for guests
- Is overridable per-row by
allow_user_switchfor support staff
For the deep walkthrough, see the dedicated guide.
filters (column filter UI)#
Comma-separated list of columns that get filter controls in the toolbar. The widget chosen depends on the field type:
- Text fields → contains-search input
- Number fields → range slider (min/max)
- Date fields → date-range picker
- Dropdown / radio / checkbox → multi-select dropdown
- Boolean → toggle button
[gravity_table id="42" filters="status,plan,created,amount"]
Filters are additive (AND-ed together) and respect every other parameter (per-user, role gates, exports).
filter (hard-coded)#
Pin a filter at render time. Useful for “Active only” pages or per-section views.
[gravity_table id="42" filter="status:active"]
Multiple values:
[gravity_table id="42" filter="status:active|trial"]
Multiple columns (comma between column rules):
[gravity_table id="42" filter="status:active,plan:pro|business"]
Hard-coded filters are not user-editable, they’re applied silently at the query layer.
Global search#
Enabled by default. Searches across every visible column. To disable:
[gravity_table id="42" search="false"]
Search is debounced 300ms client-side, then runs as a server query. Respects the same per-user / role / hard-coded filter context.
Sort#
Initial sort direction:
[gravity_table id="42" sort="created:desc"]
Multi-column sort:
[gravity_table id="42" sort="status:asc,created:desc"]
Users can override by clicking column headers. Their sort persists in localStorage scoped to the table ID.
How filters interact#
Order of operations on every render:
- Role check (
allowed_roles), denies entirely if user not in list - Hard-coded filter (
filter), narrows the dataset at query time - Per-user filter (
filter_by_user), narrows further to current user’s entries - User-applied column filters, narrow even further
- Global search, final text match
- Sort, apply user’s or default sort
- Pagination, slice for the current page
Each step is a database-layer constraint, not a client-side filter. Unauthorized users never receive filtered-out rows in the response.
Performance#
Tested up to 50,000 entries on shared hosting. Pagination is server-side; only the current page’s rows are sent to the client. The query layer uses indexed lookups via wp_gf_entry_meta joins.
For larger datasets, the Top-N display setting (top_n_count / top_n_column, shipped 4.2.54) caps the result set server-side before pagination/search/export apply, useful for leaderboards. Virtual scrolling for 10,000+ visible rows is on the 4.3 roadmap. See Performance and scaling for the full set of mitigations.