W3cubDocs

/WordPress

WP_Site_Health::admin_body_class( string $body_class ): string

Adds a class to the body HTML tag.

Description

Filters the body class string for admin pages and adds our own class for easier styling.

Parameters

$body_classstringrequired
The body class string.

Return

string The modified body class string.

Source

public function admin_body_class( $body_class ) {
	$screen = get_current_screen();
	if ( 'site-health' !== $screen->id ) {
		return $body_class;
	}

	$body_class .= ' site-health';

	return $body_class;
}

Changelog

Version Description
5.2.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_site_health/admin_body_class