wpseek.com
A WordPress-centric search engine for devs and theme authors
add_settings_field › WordPress Function
Since2.7.0
Deprecatedn/a
› add_settings_field ( $id, $title, $callback, $page, $section = 'default', $args = array() )
Parameters: (6) |
|
Defined at: |
|
Codex: | |
Change Log: |
|
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
Source
function add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array() ) {
global $wp_settings_fields;
if ( 'misc' === $page ) {
_deprecated_argument(
__FUNCTION__,
'3.0.0',
sprintf(
/* translators: %s: misc */
__( 'The "%s" options group has been removed. Use another settings group.' ),
'misc'
)
);
$page = 'general';
}
if ( 'privacy' === $page ) {
_deprecated_argument(
__FUNCTION__,
'3.5.0',
sprintf(
/* translators: %s: privacy */
__( 'The "%s" options group has been removed. Use another settings group.' ),
'privacy'
)
);
$page = 'reading';
}
$wp_settings_fields[ $page ][ $section ][ $id ] = array(
'id' => $id,
'title' => $title,
'callback' => $callback,
'args' => $args,
);
}