Overview
The Textarea field renders a multi-line text input and returns a plain string value. Use it for longer content such as descriptions, custom messages, footer text, copyright notices, or any other content that may span multiple lines.
Field Registration
php
[
'id' => 'footer_text',
'type' => 'textarea',
'title' => __('Footer Text', 'your-textdomain'),
'subtitle' => __('Shown in the footer area', 'your-textdomain'),
'default' => '© 2026 My Theme. All rights reserved.',
]
Field Options
| Option | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | Unique field identifier — used as the option key |
type | string | ✅ | Must be textarea |
title | string | ✅ | Label shown above the field |
subtitle | string | — | Smaller descriptive text shown below the label |
desc | string | — | Help text shown below the input |
default | string | — | Default value |
placeholder | string | — | Placeholder text shown inside the input when empty |
rows | int | — | Number of visible rows — default is 4 |
required | array | — | Conditional logic rules — see Conditional Logic |
Return Value
Type: string
Returns the text entered by the user, including line breaks, or the default value if nothing has been saved yet.
php
$footer_text = themeplus_get_option( 'footer_text', '' );
// Returns: '© 2026 My Theme. All rights reserved.'
Usage Examples
Basic output
php
$footer_text = themeplus_get_option( 'footer_text', '' );
if ( $footer_text ) {
echo '<p class="footer-text">' . esc_html( $footer_text ) . '</p>';
}
Preserving line breaks
php
$description = themeplus_get_option( 'about_description', '' );
if ( $description ) {
echo '<div class="about-text">';
echo wp_kses_post( wpautop( $description ) );
echo '</div>';
}
Custom copyright notice
php
$copyright = themeplus_get_option( 'copyright_text', '© ' . date('Y') . ' All rights reserved.' );
echo '<div class="copyright">' . esc_html( $copyright ) . '</div>';
With a conditional field
php
[
'id' => 'show_custom_404',
'type' => 'toggle',
'title' => __('Custom 404 Message', 'your-textdomain'),
'default' => false,
],
[
'id' => 'custom_404_text',
'type' => 'textarea',
'title' => __('404 Message Text', 'your-textdomain'),
'placeholder' => __('Sorry, the page you are looking for could not be found.', 'your-textdomain'),
'rows' => 4,
'required' => ['show_custom_404', '==', true],
],
Notes
- Always escape output with
esc_html()for plain text, orwp_kses_post( wpautop() )if you want to preserve paragraph breaks as HTML. - The Textarea field does not support HTML input from users — it stores and returns plain text only. For HTML content, use the Raw field.
- For single-line text, use the Text field instead.