The body_class hook seem only to work with non-admin pages. When I do

add_filter('body_class', 'add_body_classes');
function add_body_classes($classes) {
        $classes[] = 'myclass';
        return $classes;
}

Is there another hook i should be using if i want to add a class to the body of an admin page?

4

Admin pages don’t use the body_class filter, use the admin_body_class filter to add classes to admin body tag instead.

Note that $classes in that case is a string, not an array.

Leave a Reply

Your email address will not be published. Required fields are marked *