Skip to content
StaxWP
WordPress Plugins

How to Use ACF Fields to Determine Content Visibility in Elementor

By the StaxWP teamUpdated November 16, 20265 min read
How to Use ACF Fields to Determine Content Visibility in Elementor
Table of contents

To show or hide Elementor content based on an Advanced Custom Fields (ACF) field, install the free Visibility Logic for Elementor plugin, select the element in Elementor, open the Visibility tab, switch on Enable Visibility Logic and enable the ACF Field condition. Type the field name, choose a test such as Is not empty or Equals, and set the action to Show or Hide. The free condition reads the field of the current post or page.

That covers most needs. For user fields, options pages, term fields, repeaters or several fields at once, Visibility Logic Pro has an Advanced ACF condition. Both are below, with a worked example.

What do you need?

If ACF is not active, the ACF Field section shows a notice and the condition has no effect.

The example

A blog where some posts have a “conclusion” box written by the author, stored in an ACF field. On posts that have one, the single post template should hide the generic author box, because the conclusion already carries the author’s voice. On posts without it, the author box stays.

Step 1: Create the field in ACF

  1. In WordPress admin, open ACF > Field Groups and add a new field group, for example “Additional post content”.
  2. Add a field. Set the type (here Text Area), the label “Conclusion” and check that the field name is conclusion. The field name, not the label, is what Visibility Logic needs.
  3. Under Settings > Location Rules, show the group when Post Type is equal to Post.
  4. Save the field group.

Edit a post or two and fill in the new Conclusion field, so you have something to test with. ACF’s own documentation covers the field types and settings in depth; for this example the field name is the only detail that matters.

Step 2: Turn on Visibility Logic for the element

  1. Open the single post template, or the page, with Elementor.
  2. Select the element to control, here the Author Box widget.
  3. Open the Visibility tab. Older versions called it Stax Visibility.
  4. In the General section, switch Enable Visibility Logic to Yes.
  5. Set Show/Hide action to Hide: the author box should disappear when the condition matches.
General section of the Visibility tab with Enable Visibility Logic on, Show/Hide action Show, Conditions Type All and Keep HTML/Hide by CSS off
The General section of the Visibility tab. For this example, set Show/Hide action to Hide.

Step 3: Enable the ACF Field condition

  1. Open the ACF Field section and switch Enable to Yes.
  2. In Field Name, type conclusion. The field key works too.
  3. Set Condition to Is not empty, the default.
  4. Click Update and open a post with a conclusion and one without.

The tests available in the free condition are Is empty, Is not empty, Equals, Not equals, Contains, Is true and Is false. Value is used by Equals, Not equals and Contains. For fields with several values, such as checkboxes or a multi-select, Equals and Contains match when the value is one of the selected items. The reference is in ACF Field.

More recipes with the free condition

Goal Action Field and test
A “Featured” badge only on featured posts Show is_featured (True / False field), Is true
A download button only when a file is attached Show download_file, Is not empty
Hide the default hero when a custom hero image is set Hide custom_hero, Is not empty
A notice on posts of one type of review Show review_type (select), Equals video

When you need Advanced ACF (Pro)

The free condition reads one field of the current post. Visibility Logic Pro’s Advanced ACF condition goes further:

  • Field Source: the current post, the Current User, an Options Page, the Current Term on an archive, or a Specific Post ID.
  • Several rules in one condition, combined with AND or OR.
  • More tests: Greater than, Less than, Between, Date is before, Date is after, Has rows and Has no rows for repeaters, Array contains and Matches regex.

A typical Pro rule: show a “Renew your membership” box only to users whose user field membership_end is in the past, with Field Source Current User, Condition Date is before and Value now. Dates are read in the site time zone. See Advanced ACF.

ACF fields are stored as post meta, so Pro’s Post/Page condition can test them too, through its Meta field. Advanced ACF is the clearer choice for ACF data.

What happens to hidden content?

A hidden element is left out of the page HTML. If you turn on Keep HTML/Hide by CSS, the element is printed and hidden with CSS instead. With Pro, the Fallback section can show a text or an Elementor template in place of the hidden element (fallback content).

If you use a page cache, a rule based on the post’s own fields is safe: every visitor of that post gets the same result. Rules on the current user’s fields (Pro) differ per visitor; most caches skip logged-in users, which keeps those correct.

Free or Pro?

The free plugin includes ACF Field, User Role, User Meta, Date Time, Browser Type and Device Type. Pro adds Advanced ACF, Post/Page, Geo Location, WooCommerce and EDD customers, fallback content and more. Pro costs $29 per year for 1 site, $39 for 3 sites and $79 for 100 sites, with a 30-day money-back guarantee. See the Free vs Pro table.

The short version

Create the ACF field and note its name. In Elementor, enable Visibility Logic on the element, turn on ACF Field, type the field name, pick a test and set the action. Use Pro’s Advanced ACF for user, options or term fields, dates and repeaters. Start with the free plugin.