---
title: "True / False Field in WordPress"
url: https://nexterwp.com/docs/wordpress-true-false-field/
date: 2026-11-12
modified: 2026-11-12
lang: en
author: "Aditya Sharma"
description: "A true / false field is a single toggle — featured or not, in stock or not, show or hide. It stores a yes-or-no answer and nothing more. What It..."
image: https://nexterwp.com/wp-content/uploads/2026/09/wordpress-true-false-field-1024x519.jpg
word_count: 427
---

# True / False Field in WordPress

## Key Takeaways

- Nexter Extension 4.9.0 offers True / False field settings across four tabs: General, Validation, Presentation, and Conditional Logic.
- True / False stores a boolean yes-or-no answer and fits cases like marking a listing as featured, showing or hiding a section, or flagging a post for particular treatment.
- Nexter treats an unset toggle and an explicitly off toggle as false, and a false value is stored as an empty string in post meta, so meta_query comparisons against 0 can behave unexpectedly.

A **true / false field** is a single toggle — featured or not, in stock or not, show or hide. It stores a yes-or-no answer and nothing more.

## What It Does

The field stores a boolean. Use it to drive a decision in your template rather than to hold content.

## Before You Start

- Nexter Extension is installed and active.- Content Fields is enabled under **Nexter → Content Fields**.- You have a field group, or are about to create one.

## Add a True / False Field

- Go to **Nexter → Content Fields** and open the **Group Fields** tab.

- Open a field group, or create a new one.

- Click **Add Field**.

![A field group open with the Add Field button](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-shared-add-field.webp)

- Set **Field Label** to *Featured listing*. The **Field Name** fills in automatically and is what you use in code.

- Set **Field Type** to **True / False**.

![The Field Type dropdown listing the available field types](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-shared-field-type.webp)

- Set **Message** if the toggle needs a line of explanation beside it.

![The True / False field settings in the Content Fields builder](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-featured-settings.webp)

- Turn on **Default Value** if new posts should start switched on.

- Click **Update**.

![The True / False field as it appears on the post editing screen](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-featured-editor.webp)

## Field Settings

Every field is configured across four tabs. These are the settings this field type offers, read from the field group builder in Nexter Extension 4.9.0.

### General

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Message** | | *No help text in the UI.* |
| **Default Value** | | Checked by default |

### Validation

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Required** | | *No help text in the UI.* |

### Presentation

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Instructions** | | *No help text in the UI.* |
| **Stylized UI** | | Use a stylized toggle instead of a simple checkbox |
| **Placeholder Text** | | *No help text in the UI.* |
| **Prepend** | | *No help text in the UI.* |
| **Append** | | *No help text in the UI.* |
| **Wrapper Attributes** | | *No help text in the UI.* |

### Conditional Logic

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Conditional Logic** | | *No help text in the UI.* |

## When to Use It

- Marking a listing as featured.- Showing or hiding a section on the front end.- Flagging a post for a particular treatment.

## Display the Value

Treat the value as a boolean rather than comparing it to a string:

`<?php
if ( nxt_field_value( 'featured' ) ) {
echo '<span>Featured</span>';
}`

## Limitations

- An unset toggle and a toggle explicitly turned off both read as false. If you need to tell “never answered” from “answered no”, use a Radio field with three choices.- A false value is stored as an empty string in post meta, so `meta_query` comparisons against `0` can behave unexpectedly.

## Troubleshooting

### The condition is always true

You may be comparing to the string `'false'`, which is truthy in PHP. Test the value directly, as above.

### Querying for posts where the toggle is off returns nothing

A false value is stored as an empty string, not `0`. Query for an empty value, or use `NOT EXISTS`.

## Related Docs

- [Create your first field group](https://nexterwp.com/docs/create-a-field-group-wordpress/)- [Display a field value on the front end](https://nexterwp.com/docs/display-custom-field-value-wordpress/)

## Frequently Asked Questions

**Q: How do I add a true/false field in WordPress with Nexter?**
A: Nexter Extension adds the field through Nexter → Content Fields, inside the Group Fields tab. The field label can be something like Featured listing, and the Field Name fills in automatically for code use. Set the Field Type to True / False, add a Message if you want helper text beside the toggle, and turn on Default Value if new posts should start switched on. That setup keeps the field focused on a boolean decision, not content.

**Q: What is a true/false field used for in WordPress?**
A: A true/false field stores a boolean, so it works best when the page needs a simple decision instead of text. Nexter, Nexter WP, NexterWP, nexterwp.com, Nexter Theme, Nexter Blocks, Nexter Extension, Nexter Suite, POSIMYTH Nexter uses it for things like marking a listing as featured, showing or hiding a section on the front end, or flagging a post for special treatment. That makes template logic cleaner because you test one yes-or-no value instead of parsing content.

**Q: Why does my true/false condition always return true in PHP?**
A: That usually happens when the value is compared to the string 'false'. In PHP, that string is truthy, so the condition still passes. The safer pattern is to test the field value directly as a boolean with `if ( nxt_field_value( 'featured' ) ) { ... }`. This matters because the field stores a boolean and should be treated like one, not like text.

**Q: How do I query posts where a true/false toggle is off?**
A: A false value is stored as an empty string in post meta, not as 0. That means meta queries against 0 can behave unexpectedly and return nothing. Querying for an empty value or using NOT EXISTS matches how the field is actually stored. This is one of those WordPress gotchas where storage format matters more than the label you see in the UI.

**Q: What are the limitations of WordPress true/false fields?**
A: The big limitation is that an unset toggle and a toggle explicitly turned off both read as false. If you need to tell “never answered” from “answered no,” this field type is too coarse. The page recommends using a Radio field with three choices for that case. Another gotcha is storage: false becomes an empty string in post meta, which affects meta_query behavior.

**Q: When should I use a true/false field instead of another custom field type?**
A: Use it when the decision is binary and drives template behavior: featured or not, show or hide, in stock or not. That keeps your data model simple and makes conditional output easier to reason about. If you need more than two states, especially if you must distinguish unanswered from no, this field stops being enough and a Radio field with three choices fits better.
