apply_filters( 'admin_body_class', string $classes )

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

Description Description

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.

Top ↑

Parameters Parameters


(string) Space-separated list of CSS classes.

Top ↑

Source Source

File: wp-admin/admin-header.php

View on Trac

Top ↑

Changelog Changelog

Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Philipp Stracker

    When adding new classes to the body, you should make sure to add spaces before and after your class name. This prevents accidental concatenation of two plugins class-names.


    function admin_body_class( $classes ) {
        // Wrong: No space in the beginning/end.
        $classes .= 'my-class1 my-class2';
        // Right: Add a leading space and a trailing space.
        $classes .= ' my-class1 my-class2 ';
        return $classes;

You must log in before being able to contribute a note or feedback.