WC_Register_WP_Admin_Settings::register_page_settings( array $settings )
Registers settings to a specific group.
Description Description
Parameters Parameters
- $settings
-
(Required) Existing registered settings.
Return Return
(array)
Source Source
File: includes/class-wc-register-wp-admin-settings.php
public function register_page_settings( $settings ) {
/**
* WP admin settings can be broken down into separate sections from
* a UI standpoint. This will grab all the sections associated with
* a particular setting group (like 'products') and register them
* to the REST API.
*/
$sections = $this->object->get_sections();
if ( empty( $sections ) ) {
// Default section is just an empty string, per admin page classes.
$sections = array( '' );
}
foreach ( $sections as $section => $section_label ) {
$settings_from_section = $this->object->get_settings( $section );
foreach ( $settings_from_section as $setting ) {
if ( ! isset( $setting['id'] ) ) {
continue;
}
$setting['option_key'] = $setting['id'];
$new_setting = $this->register_setting( $setting );
if ( $new_setting ) {
$settings[] = $new_setting;
}
}
}
return $settings;
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |