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