Last updated on : August 2, 2025
The Text field provides a simple single-line input where users can enter short pieces of information, such as names, titles, or labels. It’s ideal for storing plain string values and is commonly used when you only need a basic input without formatting or multiple lines.
Settings
- Field Type : Selects the type of input field to display. The Text field creates a simple single-line input for storing plain text values, such as names, IDs, or codes.
- Field Label : The label displayed above the input field on the form. Helps users understand what information to enter.
- Field Name : A unique identifier used in the database and code. Only lowercase letters, numbers, and underscores are allowed. This value is used when retrieving and saving data.
- Required Field : Forces users to fill in this field before submitting the form. If enabled, empty values will not be accepted. Defaults to off.
- Default Value : Sets a pre-filled value that appears in the input when creating new entries. Users can change this value when filling out the form.
- Placeholder : Text that appears inside the input field when no value has been entered. Provides a visual hint or example of the expected input.
Template usage
// Get the value of the Text field (replace 'text_field_key' with your actual field name)
$text_field_value = get_post_meta( $post->ID, 'text_field_key', true );
// Output the value (if it exists)
if ( ! empty( $text_field_value ) ) {
echo '<p>Text Field Value: ' . esc_html( $text_field_value ) . '</p>';
}
That’s it! You’ve successfully configured a Text field. Now it’s ready to store and display custom content in your WordPress setup.