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.
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.
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:
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.’
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:
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.
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.
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.’
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:
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.
You will need to confirm that you want to delete the rule.
If you still want to, go ahead and click ‘Yes.’
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.
kzain
thank you for outlining the steps so clearly! Redacting sensitive information can be crucial for maintaining privacy and compliance, and it’s great to see a method for doing it directly within WordPress.
WPBeginner Support
Glad we could share this method
Admin