Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Redact Text in WordPress (The Easy Way)

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

In WordPress, redacting text can be tricky because not all themes and plugins make it easy. Many users struggle to find the right tools to redact text without messing up their website’s or blog’s design and functionality.

Text redaction means hiding or removing sensitive information from a document before sharing it.

It’s important for protecting private data, following privacy laws, and keeping confidential information safe. You can even use it as an unusual paywall or a game where you challenge visitors to fill in the missing words.

In this article, we will show you an easy way to redact text in WordPress. By the end of this article, you’ll be able to keep your site looking great while protecting sensitive information.

How to redact text in WordPress

Why Redact Text in WordPress?

Redaction is where you edit text by blacking out sensitive parts of it. It’s a way to share information and documents with the general public while keeping confidential and sensitive information private.

So, redaction can help you share real-world examples without breaking your privacy policy.

For example, if you’re a blogger trying to show visitors how to write a great CV, then you might want to include a few examples of real CVs you’ve received. You can use redaction to block out each applicant’s name, address, and other personal information.

Note that when you redact text, that content still exists in your WordPress dashboard. This means you can easily remove the redaction at any point.

Redaction can also be a great way to preview content for your WordPress membership site. Visitors can then buy a membership to remove the redaction and enjoy the full, uncensored version.

With that in mind, let’s see how you can easily redact text on your WordPress website.

How to Redact Text in WordPress

The easiest way to redact text in WordPress is with the Eyes Only plugin. It works by replacing any redacted text with a black block.

An example of redacted text on a WordPress website

Now, if a visitor highlights the block, then they’ll simply see the word REDACTED in white letters.

Here’s an example of how this might look:

An example of redacted text

Another option is to automatically replace any word or phrase with an alternative. For example, if you can’t use a client’s name on your small business website, then you might want to replace the information with a more general word like ‘client.’

To get started, you’ll need to install and activate the plugin. If you need help, then please see our guide on how to install a WordPress plugin.

Upon activation, you can redact any text by editing the HTML in the WordPress code editor.

So, the first thing you want to do is open a page or post from your WordPress admin area. Then, click on the dotted icon in the top right corner and choose ‘Code editor.’

The WordPress code editor

Next, you’ll find the piece of text that you want to redact.

And at the start of the text, you’ll want to type in the following tag:

[redact]

Now, let’s look at the end of the redacted text.

Here, you’ll type in:

[/redact]

For this guide, we’re hiding a recipient’s name by changing it to ‘the Recipient.’

Here’s what it might look like in your code editor:

The WordPress code editor

To redact more text, just repeat the same process described above.

If you want to switch back to the block editor at any point, you can simply click on the ‘Exit code editor’ button.

Exiting the WordPress code editor

After adding tags to all the text you want to redact, you can go ahead and publish or update the page.

Just be aware that the text won’t appear redacted while you’re logged into your WordPress account. To check that the text is redacted, you’ll either need to log out of your account or visit the page in an incognito tab in your web browser.

Another option is to automatically replace specific words with alternative words. This will come in very handy if there are words that you never want to show on your site. Especially if they are frequently mentioned on your website, such as the name of a confidential supplier or customer.

By configuring the plugin to redact a word automatically, you can ensure that information never appears on your website. This automated workflow can save you a lot of time and effort.

Plus, since it replaces each redacted word with an alternative word, this method can make your pages easier to read and nicer to look at. Particularly when compared to a page with lots of blacked-out content.

To redact a word or phrase automatically, you can head over to Settings » Eyes Only. Then, go ahead and click on the ‘Add new’ button.

Creating a redaction rule in WordPress

In the ‘Text’ field, simply type the text you want to redact automatically. Just be aware that the text replacement is case-sensitive, so be wary of your capitalization.

Next, you can type the text you want to show into the ‘Replacement’ field.

For example, here, we’re replacing ‘Jane Smith’ with ‘Our Client.’

The Eyes Only redaction WordPress plugin

Once done, you can go ahead and click on the ‘Add’ button.

If you want to replace more words or phrases automatically, then simply repeat the process.

Now, as we’ve already mentioned, text replacement is case-sensitive. If you want to redact a word, whether it’s capitalized or not, you’ll need to create two separate text replacement rules.

One of these rules should replace the capitalized version, and another should replace the uncapitalized version, like so:

Case-sensitive text redaction

When you’re satisfied with the redaction rules you’ve created, you can click the ‘Save Changes’ button at the bottom of the screen.

The plugin will then scan your site and automatically replace any matches that it finds.

If, at some point, you no longer want to hide a particular word or phrase, you can simply delete the redaction rule. This will automatically remove the masking and show the original words across your WordPress blog or site.

To delete a redaction rule, you’ll want to navigate to Settings » Eyes Only.

Then, just hover the mouse over the rule you want to delete and click the ‘Delete’ link when it appears.

The automatic redaction settings

You will need to confirm that you want to delete the rule.

If you still want to, go ahead and click ‘Yes.’

How to delete a text redact rule

Finally, click the ‘Save Changes’ button at the bottom. Now, if you visit any page or post with the original word, you’ll see that the plugin is no longer redacting the text.

We hope this article has helped you learn how to redact text in WordPress. You may also want to check out our guide on how to display popular posts by views and how to list future upcoming scheduled posts in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

1 CommentLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.