Get pluginBuy

Text Field

simple input type text field


	'id' => 'my_field',
	'label' => 'Label',
	'type' => 'text',


Name Description
id (String) Field id. Required.
label (String) Field label. Required.
default (String) Default predefined value.
class (String|Array) CSS classes, as an array or separated by spaces. Defaults to “regular-text”.
placeholder (String) Field placeholder.
size (Int) Field size HTML attribute.
maxlength (Int) Limit the amount of characters in this field.
description (String) Some text or HTML that will be displayed after the field.
show_if (Array) You can display this field conditionally. In order to do that pass id key and value key with an id and value of any other checkbox, select or radio field the current field should depend on. Read more about conditional logic.


Create a SEO title field in a SEO meta box for Pages post type.

add_filter( 'simple_register_metaboxes', 'misha_simple_seo_field' );
function misha_simple_seo_field( $metaboxes ) {
	$metaboxes[] = array(
		'id'	=> 'seo',
		'name'	=> 'SEO',
		'post_type' => 'page',
		'fields' => array(
			// that's our field
				'id' => 'title',
				'label' => 'SEO title',
				'maxlength' => 70,
				'type' => 'text',
	return $metaboxes;

The result:

meta box for seo

Later you can get the value of this field using default WordPress get_post_meta():

echo '<title>' . get_post_meta( $post_id, 'seo_title', true ) . '</title>';

If name parameter is not specified, meta key consists of metabox_id . '_' . field_id.