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 echos out 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.
1632functionadd_settings_section($id,$title,$callback,$page,$args=array()){1633global$wp_settings_sections;16341635$defaults=array(1636'id'=>$id,1637'title'=>$title,1638'callback'=>$callback,1639'before_section'=>'',1640'after_section'=>'',1641'section_class'=>'',1642);16431644$section=wp_parse_args($args,$defaults);16451646if('misc'===$page){1647_deprecated_argument(1648__FUNCTION__,1649'3.0.0',1650sprintf(1651/* translators: %s: misc */1652__('The "%s" options group has been removed. Use another settings group.'),1653'misc'1654)1655);1656$page='general';1657}16581659if('privacy'===$page){1660_deprecated_argument(1661__FUNCTION__,1662'3.5.0',1663sprintf(1664/* translators: %s: privacy */1665__('The "%s" options group has been removed. Use another settings group.'),1666'privacy'1667)1668);1669$page='reading';1670}16711672$wp_settings_sections[$page][$id]=$section;1673}
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 6.9.7 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.