---
title: "Text Field in WordPress"
url: https://nexterwp.com/docs/wordpress-text-field/
date: 2026-11-12
modified: 2026-11-12
lang: en
author: "Aditya Sharma"
description: "A text field stores one line of plain text — a reference code, a subtitle, a short label. It is the simplest field type and the one most sites use..."
image: https://nexterwp.com/wp-content/uploads/2026/09/wordpress-text-field-1024x519.jpg
word_count: 379
---

# Text Field in WordPress

## Key Takeaways

- Nexter Extension 4.9.0 muestra un campo de texto con opciones en cuatro pestañas: General, Validation, Presentation y Conditional Logic.
- El campo Text acepta una sola línea de texto sin formato y guarda lo que el editor escribe como una cadena plana, con sanitización de WordPress.
- Para mostrar el valor, el ejemplo usa esc_html( nxt_field_value( 'reference' ) ); y la documentación indica que para varias líneas se usa Textarea, mientras que para contenido con formato se usa WYSIWYG.

A **text field** stores one line of plain text — a reference code, a subtitle, a short label. It is the simplest field type and the one most sites use most.

## What It Does

The field accepts a single line with no formatting. Whatever the editor types is stored as-is, sanitised, and handed back to your template as a plain string.

## 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 Text 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 *Property reference*. The **Field Name** fills in automatically and is what you use in code.

- Set **Field Type** to **Text**.

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

- Click **Update**.

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

![The Text field settings in the Content Fields builder](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-reference-settings.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 |
| ------- | ------- | ------------ |
| **Default Value** | | *No help text in the UI.* |

### 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.* |
| **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

- A reference or SKU code.- A subtitle or short tagline.- A short label shown next to a title.

## Display the Value

Always escape a text value on output:

`<?php
echo esc_html( nxt_field_value( 'reference' ) );`

## Limitations

- One line only. For several lines use a Textarea field; for formatted content use a WYSIWYG field.- Whitespace at the start and end is trimmed, and runs of spaces inside are collapsed — this is WordPress sanitisation, not a Nexter behaviour.

## Troubleshooting

### My value came back with the spacing changed

Text values pass through WordPress text sanitisation, which trims the ends and collapses runs of whitespace. If exact spacing matters, use a Textarea field.

### Nothing is returned

Check you are using the **Field Name** from the builder, not the **Field Label**. They differ once you edit the label.

## 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: Why does my WordPress text field lose spacing when I save it?**
A: WordPress text sanitisation trims whitespace at the start and end, then collapses repeated spaces inside the value. That is why a text field can come back looking different even when the editor typed it correctly. Nexter, Nexter WP, NexterWP, nexterwp.com, Nexter Theme, Nexter Blocks, Nexter Extension, Nexter Suite, POSIMYTH Nexter stores the field as plain text, so exact spacing is not the right use case here. If spacing matters, use a Textarea field instead.

**Q: What should I use a WordPress text field for?**
A: A text field fits short plain-text values like a reference code, SKU code, subtitle, short tagline, or a short label next to a title. It stores one line with no formatting, so it works best when you want clean data rather than styled content. In Nexter Extension 4.9.0, that makes it the simplest field type in the builder and the one most sites use most.

**Q: How do I display a WordPress text field safely on the front end?**
A: The value should be escaped before output because the field returns plain text. The page shows this pattern: `echo esc_html( nxt_field_value( 'reference' ) );`. That matters because even simple fields should be treated as output data, not raw HTML. For front-end display workflows, pair this with [Display a field value on the front end](https://nexterwp.com/docs/display-custom-field-value-wordpress/).

**Q: What is the difference between a Field Label and Field Name in Nexter?**
A: The Field Label is what you see in the builder, while the Field Name is what you use in code. They can differ once you edit the label, which is why a value may appear to be missing if you call the wrong key. In practice, this is one of the most common setup mistakes with Nexter Extension because the label is human-friendly and the name is the actual lookup value.

**Q: When should I use a Textarea instead of a text field in WordPress?**
A: A Textarea belongs anywhere you need multiple lines or exact spacing. A text field only stores one line of plain text, and WordPress sanitisation trims ends and collapses repeated spaces inside it. That makes Textarea the better choice for content where line breaks or spacing are part of the meaning, while Text stays better for short identifiers and labels.

**Q: What do I need before adding a text field in Nexter?**
A: Nexter Extension has to be installed and active, and Content Fields must be enabled under Nexter → Content Fields. You also need an existing field group or be ready to create one first. That setup matters because the text field lives inside a group builder rather than as a standalone setting. If you're starting from scratch, [Create your first field group](https://nexterwp.com/docs/create-a-field-group-wordpress/) is the right companion step.
