add_cssclass( string $class_to_add, string $classes ): string
Adds a CSS class to a string.
Parameters
-
$class_to_add
string Required -
The CSS class to add.
-
$classes
string Required -
The string to add the CSS class to.
Return
string The string with the CSS class added.
Source
File: wp-admin/includes/menu.php
.
View all references
function add_cssclass( $class_to_add, $classes ) {
if ( empty( $classes ) ) {
return $class_to_add;
}
return $classes . ' ' . $class_to_add;
}
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Usage when working over menus order
While the function name does suggest no limitation on its availability, it is defined in
wp-admin/includes/menu.php
, so is not immediately available on the frontend (and use on the frontend is probably discouraged).