apply_filters( 'admin_body_class', string $classes )
- Since
- 2.3.0
Filters the CSS classes for the body tag in the admin.
Description
This filter differs from the 'post_class' and 'body_class' filters in two important ways:
$classesis a space-separated string of class names instead of an array.- Not all core admin classes are filterable, notably: wp-admin, wp-core-ui, and no-js cannot be removed.
Compatibility
- WordPress
- since 2.3.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$classesstring- Space-separated list of CSS classes.
Where this hook fires · 2
wp-admin/admin-header.php:242file scopewp-admin/includes/template.php:2189iframe_header()
Source code
* and no-js cannot be removed. * * @since 2.3.0 * * @param string $classes Space-separated list of CSS classes. */$admin_body_classes = apply_filters( 'admin_body_class', '' );$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class );?><body class="wp-admin wp-core-ui no-js <?php echo esc_attr( $admin_body_classes ); ?>"><script type="text/javascript"> document.body.className = document.body.className.replace('no-js','js');</script>Changelog
Introduced in 2.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.