Function: add_settings_section

add_settings_section( string $id, string $title, callable $callback, string $page )

Add a new section to a settings page.

Shortcut: ass

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

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.


Name Type(s) Default Value Description
$id string

Slug-name to identify the section. Used in the 'id' attribute of tags.

$title string

Formatted title of the section. Shown as the heading for the section.

$callback callable

Function that echos out any content at the top of the section (between heading and fields).

$page string

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();

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.