Text

Description

The Text field creates a basic text input, useful for storing single string values.

Screenshots

Changelog

  • Formatting setting removed in version 5.0.0.

Settings

  • Default Value
    The default value shown when creating a new post.

  • Placeholder Text
    Appears within input when no value exists.

  • Prepend
    Adds a visual text element before the input.

  • Append
    Adds a visual text element after the input.

  • Character Limit
    Limits the number of characters allowed.

Template usage

Display value

This example demonstrates how to display a Text field named “heading” within a <h2> tag.

<h2><?php the_field('heading'); ?></h2>

Load value

This example demonstrates how to load the value of a Text field named “confirm” and perform an action based on its value.

$confirm = get_field('confirm');
if( $confirm === 'SEND_EMAIL' ) {
    // Do something.
}

Black Friday Sale 🎉 Get 30% off new licenses and 15% off early renewals!
Coupon expires Dec 1st (11:59pm GMT) - don't miss out!

* Discounted subscriptions will renew at their full price. Cancel at any time.

Coupon Code
blackfriday2020

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.