Part of the Settings API. Use this to define new settings sections for an admin page.Show settings sections in your admin page callback function with do_settings_sections().Add settings fields to your section with add_settings_field(). The $callback argument should be the name of a function that echoes out any content you want to show at the top of the settings section before the actual fields. It can output nothing if you want.
Parameters
$idstring
Slug-name to identify the section. Used in the 'id' attribute of tags.
$titlestring
Formatted title of the section. Shown as the heading for the section.
$callbackcallable
Function that displays any content at the top of the section (between heading and fields).
$pagestring
The slug-name of the settings page on which to show the section. Built-in pages include 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using add_options_page();
$argsarrayoptional
Arguments used to create the settings section.Default: array()
$before_sectionstringdefault: empty
HTML content to prepend to the section's HTML output. Receives the section's class name as %s.
$after_sectionstringdefault: empty
HTML content to append to the section's HTML output.
$section_classstringdefault: empty
The class name to use for the section.
Uses · 3
wp_parse_args()Merges user defined arguments into defaults array.
_deprecated_argument()Marks a function argument as deprecated and inform when it has been used.
1637functionadd_settings_section($id,$title,$callback,$page,$args=array()){1638global$wp_settings_sections;16391640$defaults=array(1641'id'=>$id,1642'title'=>$title,1643'callback'=>$callback,1644'before_section'=>'',1645'after_section'=>'',1646'section_class'=>'',1647);16481649$section=wp_parse_args($args,$defaults);16501651if('misc'===$page){1652_deprecated_argument(1653__FUNCTION__,1654'3.0.0',1655sprintf(1656/* translators: %s: misc */1657__('The "%s" options group has been removed. Use another settings group.'),1658'misc'1659)1660);1661$page='general';1662}16631664if('privacy'===$page){1665_deprecated_argument(1666__FUNCTION__,1667'3.5.0',1668sprintf(1669/* translators: %s: privacy */1670__('The "%s" options group has been removed. Use another settings group.'),1671'privacy'1672)1673);1674$page='reading';1675}16761677$wp_settings_sections[$page][$id]=$section;1678}
History
Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.1.0
Added an $args parameter for the section's HTML wrapper and class name.from the docblock
2.7.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.