Table of Contents
A simple single-line text input field for capturing text values like names, titles, or short messages.
Example Usage #
sample-plugin.php
array(
'id' => 'app_name',
'title' => 'Application Name',
'desc' => 'Enter the name of your application',
'type' => 'text',
'placeholder' => 'My Awesome App',
'default' => 'My App',
'value' => get_option( 'app_name' ),
),
Properties #
- id (required) – Unique identifier for the field
- title (required) – Label displayed above the field
- desc (optional) – Help text shown below the field
- type (required) – Must be
'text','email','url','number', or'password' - placeholder (optional) – Placeholder text shown when the field is empty
- default (optional) – Default value when no value is set
- value (optional) – Current saved value, typically from
get_option()
Notes #
The property also supports 'email', 'url', 'number', and 'password' for browser validation and appropriate input keyboards on mobile devices.