Title: Testing for ACF empty (null) field
Last modified: October 27, 2019

---

# Testing for ACF empty (null) field

 *  [mwaters](https://wordpress.org/support/users/mwaters/)
 * (@mwaters)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/testing-for-acf-empty-null-field/)
 * I’m trying to test the value of a ACF custom field. Content type=product.
 * I tried the following:
 * [if content type=product field=equipment value=empty]
    <p>no value for field</
   p> [else] <h2>EQUIPMENT</h2> [content type=product field=equipment] [/if]
 * but it’s returning “no value for field” every time.
 * Do I need to create a check box that essentially is to be checked if content 
   is provided for the custom field equipment?
 * [if content type=product field=checkbox_equipment value=0]
    <p>no value for field(
   or leave blank)</p> [else] <h2>EQUIPMENT</h2> [content type=product field=equipment][/
   if]
 * I did find this exact question from a few years ago in this forum, but no one
   answered it and now it’s closed.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftesting-for-acf-empty-null-field%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [1earthsangha](https://wordpress.org/support/users/1earthsangha/)
 * (@1earthsangha)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/testing-for-acf-empty-null-field/#post-12355479)
 * Try the keyword ‘not” as it seems to work for us, e.g., when testing against 
   url parameters:
 *     ```
       [pass global=query fields=authenticated]
          [if not pass='{AUTHENTICATED}' value=true empty=false]
             <p>Account not yet authenticated.</p>
          [if]
       [/pass]
       ```
   
 * Only example.com?authenticated=true doesn’t emit the paragraph text where as
    - example.com?authenticated=false
    - example.com
    - example.com?authenticated=
    - example.com?authenticated=foobar
 * all emit “Account not yet authenticated.” By the way, it’s not clear that empty
   =false is actually required on the [if] clause, but we keep it for consistency.

Viewing 1 replies (of 1 total)

The topic ‘Testing for ACF empty (null) field’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [1earthsangha](https://wordpress.org/support/users/1earthsangha/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/testing-for-acf-empty-null-field/#post-12355479)
 * Status: not resolved