On This Page
Custom Body Class
Overview
Custom Body Class merges additional CSS class tokens into WordPress’s standard body_class() output on public pages. Enter a list in Advanced Settings usingcommas or spaces—after sanitization, those names appear on the opening body tag so your stylesheet can branch on campaign skins, seasonal branding, partner white-labels, or feature flags without redeploying PHP templates.
This complements per-user or per-role body class modules: here the list is global for all visitors, ideal when marketing turns a toggle once for the whole frontend rather than per account.

Features
body_class Filter Integration
Sanitized Tokens
Comma or Space Entry
Instant Updates
How It Works
Enable the Module
Open Advanced Settings
Save Settings
Verify Markup
Write CSS

Installation & Activation
Install WP PowerSuite
Enable Custom Body Class
Confirm Theme Supports body_class()
Coordinate with Caching

Use Cases
- PromoToggleSeasonal promo banners toggled by one body flag.
- CoBrandingPartner co-branding where legal requires distinct footer spacing.
- CoBrandingSlowly rolling out variable fonts under body.typography-v2.
Frequently Asked Questions
Does this change the admin body?
This module targets front-end visitors. Use Username Body Class or User Role Body Class for logged-in differentiation.
Can I add multiple experiments at once?
Paste multiple tokens; CSS specificity and order determine winners—document combinations for your team.
Are class names validated against BEM?
Sanitization follows WordPress slug rules; avoid spaces inside a single token.
Will this affect AMP or feeds?
AMP templates may omit custom classes; feeds are XML—scope expectations accordingly.
Can I remove default theme classes?
No—this module only appends; strip core classes only via child theme filters.
Troubleshooting
- Classes do not appearConfirm body_class() exists, no optimization plugin strips attributes, and caches cleared.
- Unexpected classes after importRe-save Advanced Settings on staging before pushing database snapshots.
- CSS not applyingCheck selector specificity vs theme !important rules; prefer higher-specificity chained selectors.
