add_settings_field [ WordPress Function ]
| Parameters: |
|
| Defined at: |
|
Add 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.
Source
<?php
function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
global $wp_settings_fields;
if ( 'misc' == $page ) {
_deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
$page = 'general';
}
if ( !isset($wp_settings_fields) )
$wp_settings_fields = array();
if ( !isset($wp_settings_fields[$page]) )
$wp_settings_fields[$page] = array();
if ( !isset($wp_settings_fields[$page][$section]) )
$wp_settings_fields[$page][$section] = array();
$wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/add settings field « WordPress Codex
Description. Register a settings field to a settings page and section. This is part of the Settings API, which lets you automatically generate wp-admin settings ...
codex.wordpress.org - WordPress › Support » Tags — add_settings_field
WordPress › Support » add_settings_field. Tag: add_settings_field Add New » ... [ resolved] add_settings_field does not save data, 17, Mark / t31os, 2 years ...
wordpress.org - admin - use add_settings_field properly? - WordPress
Sep 9, 2010 ... I'm using add_settings_field to add some more details to a settings menu, but not sure how I save the settings, or call them back in my theme.
wordpress.stackexchange.com - settings - Add_settings_field() parameterizing callback? - WordPress ...
May 19, 2011 ... I've tried using the $args parameter for add_setitngs_feild(), but sadly, it does not work. For example: add_settings_field('name', 'Field Name', ...
wordpress.stackexchange.com
Kullanýcý Tartýþmalarý [ wordpress.org ]
- huntermaster on "SAPI-generated field label truncated"
- woodenpier on "testing if settings field has been updated"
- Mark / t31os on "add_settings_field does not save data"
- spstieng on "add_settings_field does not save data"
- Mark / t31os on "add_settings_field does not save data"
- spstieng on "add_settings_field does not save data"
- Mark / t31os on "add_settings_field does not save data"
- spstieng on "add_settings_field does not save data"
- Mark / t31os on "add_settings_field does not save data"
- spstieng on "add_settings_field does not save data"