add_settings_section()WP 2.7.0

Add a new section to a settings page.

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.

No Hooks.


null. Nothing.


add_settings_section( $id, $title, $callback, $page );
$id(string) (required)
Slug-name to identify the section. Used in the 'id' attribute of tags.
$title(string) (required)
Formatted title of the section. Shown as the heading for the section.
$callback(callable) (required)
Function that echos out any content at the top of the section (between heading and fields).
$page(string) (required)
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();


  • Global. Array. $wp_settings_sections Storage array of all settings sections added to admin pages.


Since 2.7.0 Introduced.

Code of add_settings_section() WP 6.0

function add_settings_section( $id, $title, $callback, $page ) {
	global $wp_settings_sections;

	if ( 'misc' === $page ) {
				/* translators: %s: misc */
				__( 'The "%s" options group has been removed. Use another settings group.' ),
		$page = 'general';

	if ( 'privacy' === $page ) {
				/* translators: %s: privacy */
				__( 'The "%s" options group has been removed. Use another settings group.' ),
		$page = 'reading';

	$wp_settings_sections[ $page ][ $id ] = array(
		'id'       => $id,
		'title'    => $title,
		'callback' => $callback,