WPDev.one
Core Function
View Source on Trac ↗

add_settings_field()

add_settings_field( mixed $id, mixed $title, mixed $callback, mixed $page, mixed $section = 'default', mixed $args = array() )

Adds a new field to a section of a settings page.

Parameters 6 required

Name / Type Description
$id
string

Slug-name to identify the field. Used in the 'id' attribute of tags.

Required
string

$title Formatted title of the field. Shown as the label for the field during output.

Required
callable

$callback Function that fills the field with the desired form inputs. The function should echo its output.

Required
string

$page The slug-name of the settings page on which to show the section (general, reading, writing, ...).

Required
string

$section Optional. The slug-name of the section of the settings page in which to show the box. Default 'default'.

Required
array

$args { Optional. Extra arguments that get passed to the callback function.

Required

Return Value

(void)
No return value description available.

Function Information

Since Version
2.7.0
Source File
wp-admin/includes/template.php
Advertisement