Why does admin_body_class not work?

This works for the admin backend; I needed to restructure the filter to be able to add a priority: function add_admin_body_class($classes) { $user = wp_get_current_user(); foreach ($user->roles as $user_role) { $classes .= ” role-{$user_role}”; } return $classes; } add_filter(“admin_body_class”, “add_admin_body_class”, 9999);

Retrieve user roles but exclude default roles

So I ended up using a combination of the array_filter function and the in_array function to retrieve all custom roles like this: <?php function check_roles($userRole) { $default_roles = array(‘Administrator’, ‘Editor’, ‘Author’, ‘Contributor’, ‘Subscriber’); if (!in_array($userRole, $default_roles)) { return $userRole; } } $all_roles = wp_roles()->get_names(); $custom_roles = array_filter($all_roles, ‘check_roles’); foreach ($custom_roles as $role) { echo $role; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)