Opened 15 years ago
Closed 15 years ago
#18853 closed defect (bug) (fixed)
Menus Admin Screen Doesn't Accept Body Classes
| Reported by: | JohnONolan | Owned by: | dd32 |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3 |
| Component: | Administration | Version: | 3.3 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
This is going to be a hazy bug report, because it's at the outer limits of my technical ability, but:
Using this code
function my_admin_body_class( $classes ) {
if ( is_admin() ) {
$classes .= 'extra-class';
}
return $classes;
}
add_filter('admin_body_class', 'my_admin_body_class');
I can add a class of "extra-class" to the admin body tag on every single page... except Appearance > Menus. Where the class doesn't get inserted at all.
I'm seeing this both in 3.2 and latest trunk. Apologies if this is something I'm doing wrong... like I say - outer limits.
Attachments (3)
Change History (10)
#3
@
15 years ago
Same for Widgets screen in the accessibility mode:
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-admin/widgets.php#L26
A workaround could be calling the function with a later priority and with a whitespace in the string:
function my_admin_body_class( $classes ) {
if ( is_admin() ) {
$classes .= ' extra-class';
}
return $classes;
}
add_filter('admin_body_class', 'my_admin_body_class', 11);
#4
@
15 years ago
- Milestone Awaiting Review → 3.3
Geeze, SergeyBiryukov even beats me these days!
I've just gone through checking this whilst you guys were busy posting, Widgets and Menu's are the only location which overwrites, menu uses add_action rather than add_filter and iframe's don't get the admin_body_class filter at all (and are missing the wp-admin class too)
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Confirmed. The culprit is lines 435-440 in
wp-admin/nav-menus.phpwhich is treatingadmin_body_classas an action instead of a filter and not returning anything.