Content Module

User Role Body Class

User Role Body Classes adds the current user role as a CSS class to the body tag on the frontend. Logged-in administrators get role-administrator class, editors get role-editor, and so on. Logged-out visitors get role-guest. This enables role-specific CSS styling to show different designs or hide elements based on who is viewing the page.

body-class user-roles css customization styling

User Role Body Class Part of 165+ modules $349 $249

Get Lifetime Access

Key Features

Role-based body classes
Conditional styling support
Better CSS targeting

Why Use This Module?

  • Role-based CSS classes
  • Style by user role
  • Show or hide content with CSS
  • role-guest for logged out
  • Frontend styling control

Real-World Use Cases

Member-Only Styling

Style pages differently for logged-in members versus guests using CSS targeting 'role-subscriber' body class.

Admin Preview Mode

Show draft content or admin tools only to administrators using role-based CSS visibility controls.

Tiered Membership

Apply different styling or show/hide elements based on user membership level for premium content sites.

How to Use

Activate the module. Body classes will be automatically added based on the current user's role.

Benefits & Impact

Time Savings

Automates manual tasks and streamlines your workflow

Performance Boost

Enhances overall site functionality

Better UX

Improves content management and organization

Easy Maintenance

Simple setup with minimal ongoing maintenance

Frequently Asked Questions

What class do logged-out users get?

role-guest class is added for visitors who are not logged in.

Can I use this to hide content?

Yes, use CSS to display:none for certain role classes. Not secure for sensitive content.

Does this work with custom roles?

Yes, any role name becomes a class like role-customrole.

What Users Are Saying

"Members see different styling than guests. Role classes make it simple."

— Membership Site

"Admin users see additional UI elements. CSS targets role-administrator."

— Staff Portal

"Free vs paid members styled differently with role classes."

— Freemium Site

Related Modules

CONTENT

Accessibility Widget

Add frontend accessibility widget with font size controls, contrast adjustments, and keyboard navigation improvements for WCAG compliance and better user experience

accessibility a11y widget +2
CONTENT

Auto Featured Image

Automatically set first image in post content as featured image if none is set to ensure all posts have featured images for better appearance and social sharing

featured-image automation images +2
CONTENT

Auto Publish Missed Schedule

Automatically publish posts that missed their scheduled publication time due to server issues, traffic spikes, or cron failures to ensure content goes live as planned

scheduling posts automation +2
WPSwitchboard

165+ Modules.
One Plugin. Done.

Security, admin tools, performance, SEO, and more. All in one place.

Get Lifetime Access - $349 $249
Core Modules
165+
Admin Tools, Security, Optimization, and more
Enhance your WordPress admin experience
Admin Tools
Dashboard Enhancements
Customize admin interface
Security & Performance
Optimization Modules
Secure & optimize your site