WC_Settings_Page::add_settings_ui_body_class
Add a body class for settings pages rendered through the settings UI.
Method of the class: WC_Settings_Page{}
No Hooks.
Returns
String. The modified body classes for the admin area.
Usage
$WC_Settings_Page = new WC_Settings_Page(); $WC_Settings_Page->add_settings_ui_body_class( $classes );
- $classes(string) (required)
- The existing body classes for the admin area.
Changelog
| Since 10.9.0 | Introduced. |
WC_Settings_Page::add_settings_ui_body_class() WC Settings Page::add settings ui body class code WC 10.9.3
public function add_settings_ui_body_class( $classes ) {
global $current_section, $current_tab;
if ( ! is_string( $classes ) || $this->id !== $current_tab ) {
return $classes;
}
$section = is_string( $current_section ) ? $current_section : '';
$context = $this->get_settings_ui_request_context( $section );
if ( ! $context || ! $context->is_rendering_enabled() ) {
return $classes;
}
if ( str_contains( $classes, 'woocommerce-settings-ui-page' ) ) {
return $classes;
}
return "$classes woocommerce-settings-ui-page";
}