When to use Advanced Filtering vs Field Conditional Logic vs gvlogic
GravityView includes three features that use conditional logic: Advanced Filtering, Field Conditional Logic, and the [gvlogic] shortcode. All three let you control what appears in your View based on conditions you define, but they each operate at a different level. This article explains what each feature does, when to use it, and how to choose the right one for your situation.
Prefer to watch the video?
Quick comparison
|
|
Advanced Filtering | Field Conditional Logic | [gvlogic] shortcode |
| What it controls | Which entries appear | Which fields are visible | What content renders |
| Level | Entries (rows) | Fields (columns/cells) | Content (text/HTML) |
| Where it's configured | View Settings > Filter & Sort | Per-field settings in the View Editor | Inside a Custom Content field or anywhere on your site |
| Can transform output | No | No | Yes (via custom content) |
| Requires shortcode knowledge | No | No | Yes |
| Requires Advanced Filter Extension | Yes | Yes | No |
| Performance | Fast (server-side query) | Fast (simple show/hide) | Slower (executes per entry) |
Advanced Filtering
Advanced Filtering controls which entries appear in your View. It works at the entry level. Entries that don't match your conditions are excluded from the View entirely.
Use Advanced Filtering when you want to:
- Show only entries submitted by the currently logged-in user
- Limit entries to a specific date range (e.g., the current week or month)
- Filter entries by approval status
- Display entries matching a specific user role
- Combine multiple conditions using AND/OR logic
How it works
Advanced Filtering adds conditions to your View that run as a server-side query. Only entries matching your conditions are retrieved from the database, so visitors never see excluded entries.
- Open your View in the View Editor.
- Scroll down to View Settings and click the Filter & Sort tab.
- Click Add Condition under Advanced Filter.
- Configure your condition by selecting a field, an operator, and a value.
To add more conditions, click + AND (all conditions must be true) or + OR (at least one condition must be true). You can also create groups to combine AND and OR logic in the same filter.
Note: Advanced Filtering also supports filtering across joined forms when using the Multiple Forms feature.
Example
You run a job board and want to show only job listings that are marked as "Open" and were posted within the last 30 days. You set two AND conditions in Advanced Filtering: Status is Open and Date Created is after 30 days ago . Entries that are closed or older than 30 days don't appear in the View at all.
Field Conditional Logic
Field Conditional Logic controls which fields are visible within entries that are already displayed. It works at the field level. The entry still appears in the View, but specific fields within it are shown or hidden based on conditions.
Use Field Conditional Logic when you want to:
- Hide a field when its value is empty
- Show a placeholder image when a photo field has no value
- Display a field only when a related field meets a condition
- Show or hide fields without writing any shortcode
How it works
Field Conditional Logic is configured directly in the field settings inside the View Editor. You add conditions that determine whether a field is visible for each entry. Because it's a simple show/hide toggle, it's fast and efficient—there is no per-entry processing overhead.
- Open your View in the View Editor.
- Click the gear icon on any field to open its settings.
- Look for the Field Conditional Logic section.
- Add one or more conditions using the AND/OR operators.
Note: Field Conditional Logic requires the Advanced Filter Extension to be installed and activated.
Field Conditional Logic also supports relative dates for date comparisons, and works across joined forms when using Multiple Forms.
Example
You have a directory of team members. Some members have uploaded a profile photo, and some haven't. You add Field Conditional Logic to the Photo field: display if Photo is not empty. You then add a placeholder image and set it to display if Photo is empty.
The result: every entry shows either the uploaded photo or the placeholder.
When to choose Field Conditional Logic over gvlogic
If you only need to show or hide a field based on a condition, Field Conditional Logic is the better choice. It's:
- Easier to configure: no shortcode syntax to learn
- Faster: it runs as a simple show/hide toggle rather than processing each entry individually
- Visual: you configure it directly in the View Editor alongside your other field settings
The [gvlogic] shortcode
The [gvlogic] shortcode controls what content renders based on conditions. Unlike Field Conditional Logic, it doesn't just show or hide a field—it can transform the output (e.g., wrapping values in HTML, displaying different text, or rendering content outside of the entry depending on the condition).
Use [gvlogic] when you want to:
- Display different text based on a field's value (e.g., show "Overdue" in red when a date has passed)
- Wrap a field value in custom HTML or CSS classes
- Show content based on the visitor's login status
- Chain multiple conditions with
[else if]blocks - Display conditional content outside of a View (on any page, post, or widget)
How it works
You place the [gvlogic] shortcode inside a Custom Content field in the View Editor, or anywhere on your WordPress site that supports shortcodes.
The basic syntax:
[gvlogic if="{Field:ID}" is="value"]
Content to display when the condition is true
[else]
Content to display when the condition is false
[/gvlogic]
[gvlogic] supports a range of comparison operators:
| Operator | What it does |
|---|---|
is / equals |
Exact match |
isnot |
Not equal |
contains |
Value includes the text |
not_contains |
Value does not include the text |
starts_with |
Value begins with the text |
ends_with |
Value ends with the text |
greater_than |
Greater than (works with numbers and dates) |
less_than |
Less than (works with numbers and dates) |
Note:[gvlogic] executes once per entry in your View. For Views with many entries, this is slower than Field Conditional Logic. If you only need to show or hide a field (without transforming the output), use Field Conditional Logic instead.
Example
You have a task tracker and want to display the priority level with a colored label. In a Custom Content field, you write:
[gvlogic if="{Priority:5}" is="High"]
<span style="color: red; font-weight: bold;">High Priority</span>
[else if="{Priority:5}" is="Medium"]
<span style="color: orange;">Medium Priority</span>
[else]
<span style="color: green;">Low Priority</span>
[/gvlogic]
This isn't possible with Field Conditional Logic because you're not just showing or hiding a field, you're transforming how the value is displayed.
Using gvlogic outside of Views
The [gvlogic] shortcode also works outside of GravityView Views—on any page, post, or widget on your WordPress site. When used outside a View, you can use merge tags that don't depend on form data, such as:
Choosing the right feature
Use this decision tree to pick the right tool:
"I want to control which entries appear in my View." → Use Advanced Filtering. It filters entries at the database level before they reach the page.
"I want to show or hide a field based on a condition." → Use Field Conditional Logic. It's faster, easier to configure, and doesn't require shortcode knowledge.
"I want to change how a field's value is displayed, wrap it in HTML, or show different content based on a condition." → Use [gvlogic] . It's the only option that can transform output, not just show or hide it.
"I want to display conditional content outside of a View." → Use [gvlogic] . It works anywhere on your WordPress site, not just inside Views.
"I want to show or hide content based on login status." → Use [gvlogic] with the logged_in parameter. This works both inside and outside of Views.
Can I combine them?
Yes. These three features work well together because they operate at different levels:
- Advanced Filtering narrows down which entries appear in the View.
- Field Conditional Logic controls which fields are visible within those entries.
[gvlogic]customizes the content that renders inside specific fields.
For example, you could use Advanced Filtering to show only approved entries, Field Conditional Logic to hide empty photo fields, and [gvlogic] to display a colored status badge, all in the same View.