View Categories

Field Type: Number

Table of Contents

A numeric input field with browser validation for entering integers or decimal numbers.

Example Usage #

sample-plugin.php
array(
	'id'          => 'max_users',
	'title'       => 'Maximum Users',
	'desc'        => 'Set the maximum number of concurrent users allowed',
	'type'        => 'number',
	'placeholder' => 100,
	'default'     => 50,
	'value'       => get_option( 'max_users' ),
),

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 'number'
  • placeholder (optional) – Placeholder number shown when field is empty
  • default (optional) – Default numeric value
  • value (optional) – Current saved value

Notes #

Browser validation automatically prevents non-numeric input. Mobile devices will display a numeric keyboard for easier input.