admin_body_class filter-hookWP 2.3.0

Filters the CSS classes for the body tag in the admin.

This filter differs from the post_class and body_class filters in two important ways:

  1. $classes is a space-separated string of class names instead of an array.
  2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui,
    and no-js cannot be removed.

Usage

add_filter( 'admin_body_class', 'wp_kama_admin_body_class_filter' );

/**
 * Function for `admin_body_class` filter-hook.
 * 
 * @param string $classes Space-separated list of CSS classes.
 *
 * @return string
 */
function wp_kama_admin_body_class_filter( $classes ){

	// filter...
	return $classes;
}
$classes(string)
Space-separated list of CSS classes.

Changelog

Since 2.3.0 Introduced.

Where the hook is called

In file: /wp-admin/admin-header.php
admin_body_class
wp-admin/admin-header.php 242
$admin_body_classes = apply_filters( 'admin_body_class', '' );
wp-admin/includes/template.php 2081
$admin_body_classes = apply_filters( 'admin_body_class', '' );

Where the hook is used in WordPress

wp-admin/includes/class-wp-site-health.php 49
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
wp-admin/nav-menus.php 592
add_filter( 'admin_body_class', 'wp_nav_menu_max_depth' );
wp-admin/widgets-form.php 23
add_filter( 'admin_body_class', 'wp_widgets_access_body_class' );