add_settings_field


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

Parameters:
  • (string) id Slug-name to identify the field. Used in the 'id' attribute of tags.
  • (string) title Formatted title of the field. Shown as the label for the field during output.
  • (callable) callback Function that fills the field with the desired form inputs. The function should echo its output.
  • (string) page The slug-name of the settings page on which to show the section (general, reading, writing, ...).
  • (string) section Optional. The slug-name of the section of the settings page in which to show the box. Default 'default'.
  • (array) args { Optional. Extra arguments that get passed to the callback function. @type string $label_for When supplied, the setting title will be wrapped in a `<label>` element, its `for` attribute populated with this value. @type string $class CSS Class to be added to the `<tr>` element when the field is output. }
Defined at:
Change Log:
  • 4: .

Description

Adds a new field to a section of a settings page.Part of the Settings API. Use this to define a settings field that will show as part of a settings section inside a settings page. The fields are shown using do_settings_fields() in do_settings_sections(). The $callback argument should be the name of a function that echoes out the HTML input tags for this setting field. Use get_option() to retrieve existing values to show.

Related Functions

do_settings_fields, settings_fields, add_settings_error, add_settings_section, do_settings_sections

Top Google Results

User discussions

wpseek mobile