Hide Theme Style Paths and Comments in WordPress with WP Ghost
January 26, 2019
This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.
Hide WordPress paths and comments inside your theme’s stylesheet using WP Ghost (formerly Hide My WP Ghost). WordPress theme stylesheets contain a comment header with the theme name, version, author, and URL. WP Ghost offers two approaches: dynamic loading via a UI toggle (recommended), or combining CSS files with a cache plugin. No wp-config.php editing is required for either method.
What the Theme Style Reveals
Every WordPress theme’s style.css file starts with a comment header that identifies the theme name, version, author, author URI, and description. CMS scanners read this header to identify your exact theme. WP Ghost changes the theme path, but if the stylesheet is loaded statically (as it normally is for performance), the comment header inside the file is not modified.
There are two ways to solve this. The recommended method uses WP Ghost’s built-in Text Mapping feature. The alternative uses a cache plugin to combine CSS files.
Method 1: Enable Text Mapping in CSS and JS Files (Recommended)
This is the current built-in solution. It processes CSS and JS files dynamically so WP Ghost can change paths and remove identifying content inside them.
Go to WP Ghost > Mapping > Text Mapping. Switch on Text Mapping in CSS and JS files including cached files. Click Save.

With this enabled, WP Ghost dynamically processes CSS and JS files to replace WordPress paths and theme identifiers. Use a caching plugin to cache the processed output and maintain fast loading speeds.
You can also rename the theme style filename itself. Go to WP Ghost > Change Paths > Theme Security > Custom Theme Style Name. Enter a custom name ending in .css (e.g., design.css). Click Save.
Method 2: Combine CSS with a Cache Plugin
If you use a caching plugin that combines CSS files (WP Rocket, Autoptimize, LiteSpeed Cache, etc.), the theme’s style.css gets merged into a single combined file. The comment header is stripped during the combination process. Then enable Change Paths in Cached Files in WP Ghost > Tweaks to rewrite any remaining WordPress paths in the combined file.
This method is fully automatic with no performance trade-off since the caching plugin handles the optimization.
Troubleshooting
Theme style breaks after enabling dynamic loading
Clear all caches (browser, caching plugin, CDN) and test in a private browser. If the style still breaks, check that the custom theme style name ends in .css. Test with a default WordPress theme to confirm the issue is theme-specific.
Site loads slower after enabling Text Mapping in CSS and JS
CSS and JS files are processed dynamically when this option is active. Use a caching plugin so the processed output is cached after the first load. Subsequent visits serve from cache at normal speed. This is also why Method 2 (combining via cache plugin) can be preferable for performance-sensitive sites.
Frequently Asked Questions
Do I still need the HMW_DYNAMIC_FILES constant in wp-config.php?
No. The Text Mapping in CSS and JS files toggle in WP Ghost > Mapping > Text Mapping is the UI equivalent of this constant. If you previously added it to wp-config.php, you can remove it. The UI toggle takes precedence.
Which method should I use?
If you already use a caching plugin that combines CSS files, Method 2 is the easiest and has no performance impact. If you do not use a caching plugin or your cache plugin does not combine CSS, use Method 1 with a caching plugin to cache the dynamic output.
Does renaming the theme style file affect the theme editor?
No. The Custom Theme Style Name only changes how the file is referenced in the frontend HTML. The actual style.css file on disk remains unchanged. The WordPress theme editor continues to work normally.
Will this remove the “Theme Name” and “Author” comments from the CSS?
When CSS files are combined by a caching plugin, the comment header is stripped during minification. When using dynamic loading (Method 1), WP Ghost processes the file content but the comment removal depends on the specific processing. For guaranteed comment removal, use a cache plugin with CSS combination enabled.
Does WP Ghost modify WordPress core files?
No. WP Ghost processes CSS output at runtime or modifies cached copies. The original theme style.css on disk is untouched. Disabling restores all original file references instantly.
Related Tutorials
Hide WordPress Paths in CSS Files – the full guide to Change Paths in Cached Files.
Text Mapping and URL Mapping – rename class names and text in source code.
Change the Themes Path – hide the theme directory path alongside style name.
Hide from Theme Detectors – complete CMS hiding strategy.
Website Security Check – verify your configuration after changes.