Skip to contentSkip to main navigation Skip to footer

Advanced Text Mapping in WP Ghost – {blank} and {rand} Patterns

Moved

This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.

View on new site

Use WP Ghost’s (formerly Hide My WP Ghost) {blank} and {rand} replacement patterns to remove or randomize WordPress class names in your source code. Standard Text Mapping replaces one class with another. Advanced patterns go further: {blank} removes the class entirely, {rand} replaces it with a random string that changes on every page load.

The {blank} Pattern — Remove a Class Entirely

Use {blank} when you want to remove a class name without replacing it. In WP Ghost > Mapping > Text Mapping, enter the class name in the left field and {blank} in the right field. The class name disappears from the HTML output.

Example: wp-caption => {blank}

Before: <div class="caption aligncenter">

After: <div class=" aligncenter">

Use {blank} for class names that are purely WordPress identifiers with no styling attached. If the class is used by CSS for layout, removing it will break the design.

WP Ghost Text Mapping showing {blank} pattern to remove a name

The {rand} Pattern — Randomize a Class Name

Use {rand} when you want to replace a class name with a random string that changes on every page load. Enter the class name in the left field and {rand} in the right field.

Example: wp-block => {rand}

Before: <div class="block-image">

After: <div class="x7k2m-image"> (random string changes each load)

A fixed replacement like wp-block => site-block is consistent — once a scanner learns your replacement, it can track it. With {rand}, the replacement is different every time, making pattern recognition impossible.

WP Ghost Text Mapping showing {rand} pattern to randomize a name

Enable CSS and JS mapping with {rand}

If you use {rand}, enable Text Mapping in CSS and JS files so the random string is consistent across HTML, CSS, and JavaScript within the same page load. Without this, HTML has a random name but CSS still targets the original — breaking styles.


Which Classes to Map First

The most detectable WordPress classes are those with the wp- prefix. These are unique to WordPress and are the first thing theme detectors look for. Search your page source (Ctrl+U in a private browser) for “wp-” and add the matches to Text Mapping.

Priority classes: wp-block, wp-image, wp-caption, wp-embed, wp-element, wp-container. WP Ghost includes a predefined list of common WordPress class names you can add with one click.

WP Ghost Text Mapping demo showing recommended WordPress name mappings

Always check the frontend

After adding any mapping rule, check your site’s frontend in a private browser to confirm the layout is not broken. Some classes are used by your theme for styling and removing or randomizing them will affect the design.


Frequently Asked Questions

When should I use {blank} vs {rand}?

Use {blank} for classes that are purely identifiers with no CSS styling attached — removing them has no visual effect. Use {rand} for classes that have CSS styling, since {rand} keeps the styling functional (when CSS/JS mapping is enabled) while making the name unpredictable. If unsure, use a fixed custom replacement first and test.

Does {rand} work with caching plugins?

With caching, the random string is generated when the cache is built and stays the same until the cache is regenerated. The replacement is consistent for cached pages but changes on regeneration. This still provides effective hiding since each cache rebuild generates new random strings.

Can I combine {blank} and {rand} with regular mappings?

Yes. You can use all three types in the same configuration: regular fixed replacements (wp-block => site-block), {blank} for classes you want removed, and {rand} for classes you want randomized. Each rule operates independently.

What if a mapping breaks my site?

Remove the problematic rule from WP Ghost > Mapping > Text Mapping, clear all caches, and test again. If you cannot access admin, use the Safe URL parameter or the Emergency Disable guide.

Does WP Ghost modify WordPress core files?

No. Text Mapping operates on HTML output at runtime and on dynamically generated copies of CSS/JS files. Original files are never modified. Disabling restores all class names instantly.


Text Mapping and URL Mapping – the complete Text Mapping guide with all features.

Hide Gutenberg Block Classes – hide wp-block class names specifically.

Hide from Theme Detectors – complete CMS hiding strategy including class names.

URL Mapping – change remaining asset URLs in source code.

Website Security Check – verify no WordPress fingerprints remain.