bookmark_borderSave Button

Introduction

The save type field, part of the Settings API, renders a submit type input.

Example

The following example renders a section with a text input and a save button with custom error and success messages.

array(
	'title'  => esc_html__( 'This is the title for Section 1', 'sometextdomain' ),
	'fields' => array(
		array(
			'type'  => 'text',
			'name'  => 'mytextfield',
			'label' => esc_html__( 'This is my text field', 'sometextdomain' ),
		),
		array(
			'type'     => 'save',
			'messages' => array(
				'error'   => esc_html__( 'Settings could not be updated.', 'sometextdomain' ),
				'success' => esc_html__( 'Settings have been updated.', 'sometextdomain' ),
			),
		),
	),
),

The code above will render a layout similar to the following:

save-button