Uses
Uses | Description |
---|---|
wp-admin/includes/template.php: do_settings_fields() | Print out the settings fields for a particular settings section. |
Prints out all settings sections added to a particular settings page
Part of the Settings API. Use this in a settings page callback function to output all the sections and fields that were added to that $page with add_settings_section() and add_settings_field()
(string) (Required) The slug name of the page whose settings sections you want to output.
This will output the section titles wrapped in h3 tags and the settings fields wrapped in tables.
File: wp-admin/includes/template.php
function do_settings_sections( $page ) { global $wp_settings_sections, $wp_settings_fields; if ( ! isset( $wp_settings_sections[ $page ] ) ) { return; } foreach ( (array) $wp_settings_sections[ $page ] as $section ) { if ( $section['title'] ) { echo "<h2>{$section['title']}</h2>\n"; } if ( $section['callback'] ) { call_user_func( $section['callback'], $section ); } if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { continue; } echo '<table class="form-table" role="presentation">'; do_settings_fields( $page, $section['id'] ); echo '</table>'; } }
Version | Description |
---|---|
2.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/do_settings_sections