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.
1634functionadd_settings_section($id,$title,$callback,$page,$args=array()){1635global$wp_settings_sections;16361637$defaults=array(1638'id'=>$id,1639'title'=>$title,1640'callback'=>$callback,1641'before_section'=>'',1642'after_section'=>'',1643'section_class'=>'',1644);16451646$section=wp_parse_args($args,$defaults);16471648if('misc'===$page){1649_deprecated_argument(1650__FUNCTION__,1651'3.0.0',1652sprintf(1653/* translators: %s: misc */1654__('The "%s" options group has been removed. Use another settings group.'),1655'misc'1656)1657);1658$page='general';1659}16601661if('privacy'===$page){1662_deprecated_argument(1663__FUNCTION__,1664'3.5.0',1665sprintf(1666/* translators: %s: privacy */1667__('The "%s" options group has been removed. Use another settings group.'),1668'privacy'1669)1670);1671$page='reading';1672}16731674$wp_settings_sections[$page][$id]=$section;1675}
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.1.0 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.