A word replacement plugin for WordPress

Post length: 355 words, about 1 and a half minutes.

Text Obfuscator (formally known as Obfuscator) is a simple plugin for replacing words and phrases in your posts’ content with alternative words and phrases. Initially designed for protecting the innocent by removing names from personal blog posts, it can also be used to correct common spelling errors or automatically expand abbreviations. The plugin operates on output preserving the content in the database as entered in the post.

Versions up to and including 1.0 (0.1 and 0.2 released under the title Obfuscator) are very basic string replacement systems. Versions 1.1 and 1.2 are a little more advanced.

Text Obfuscator development is very gentle and updates are released relativly infrequently, but comments, bugs and suggestions are all very welcome and will generally be acted on reasonably quickly. Also, if you use the plugin it would be great if you could drop me a line (or write a little blog post) so I can see it in action!

Planned features

The following is a none-exhaustive list of features planned for forthcoming releases:

  • Advanced replacement rules through regular expressions.
  • Option for post modifcations to be made pre-submission (ie. make the replacements before the post is saved to the database), or pre-display (ie. make the replacements when the post is retrieved from the database as currently).
  • Extend replacement rules to comments.
  • Separate replacement rules for posts, pages and comments.
  • Shortcode to build ‘replacement dictionary’ pages.

The current latest version is 1.2 and a brief changelog is below.

Changelog

Version 1.2:

  • Added option to match partial words.
  • Extracted regular expression building into it’s own function called by all replacement functions.

Version 1.1:

  • Added ability to optionally do replacement in blog posts, titles, excerpts and comments.
  • Added ability to apply each filter on input or output.
  • Fixed a bug blanking posts when there were no replacement rules.
  • Modified escaping to use WP’s built in routines.
  • Added comments throughout.

Version 1.0:

  • Updated to use settings methods added to WP2.7.
  • Released on the WordPress plugin directory.

Version 0.2:

  • Changes to the way the rules are stored to prevent them getting mixed up.
  • Minor changes to conditional logic.
  • Minor changes to some wording on the admin page.

Download the latest version of the plug in.

Posted on Tuesday 22nd February, 2011 at 12:06 am in Text Obfuscator.
It was tagged with , , , .

15 comments

Hi,

does it work with elements of code? For example if I want to replace <b> tag with <strong>? (it’s just an example)
This “words” can’t be read by visitors so that’s why I’m wondering if it makes a difference…

Posted on 28th Mar 2011 at 10:39 pm by OrdiFacil'.

Currently that wouldn’t work because the plugin only matches full words (strings with non-word characters, such as a space or punctuation) at both the begining and end. I’ll push an update which allows you to choose either full words or part words in a few minutes. To replace tags you’d select part word matching.

One thing to bear in mind though is that currently you’ll need to enter a rule for the opening <b> and the closing </b> tags separatly.

Posted on 29th Mar 2011 at 2:23 am by Jonathon.

Just great. Testing it now and it works fine. It does what it’s made for and anyone can set it up in a few seconds. The improvements you’ve added are very useful, I really appreciate your reactivity.

I’m still desperately waiting for a plugin allowing to remove everything between “word1” and “word2” (word1*word2) without being forced to become a RegEx guru. My lack of skills about Regular Expressions is the reason why I can’t use the Word Replacer plugin by Takien. If only I had more time to learn everything…
So for now I’ll continue to play with the toy that you’ve made available to everyone here. Thanks a lot for your work, for sharing it with us and for your super-fast and clear support.

If you want to translate it in French, consider myself as a candidate to contribute. I’ld be glad to give you some of my time as you did for me. Btw I’m not so bad in graphics too 🙂

Posted on 30th Mar 2011 at 1:37 am by OrdiFacil'.

I’m trying to replace a part of the posts code with nothing because I want to remove it (Replacement field blank). For the first rule, it worked fine. But when creating a second rule, I click on ‘Save changes’ button and my 2nd rule just disappear. I’ve tried several times but the error is repeated.
It seems to be due to the replacement field that I’ve left blank. Do you think it is really the cause?

Posted on 30th Mar 2011 at 2:15 am by OrdiFacil'.

Intereting. I never though of using it to remove bits of the text. I’ll have a look at how I might implement that without you having to come up with a workaround like this. I think that’ll also ‘fix’ the saving problem 🙂

Thanks for your suggestions.

Posted on 30th Mar 2011 at 8:13 pm by Jonathon.

The problem of second rule disappearing was caused yesterday by the fact that your plugin couldn’t create a new blank row if I leave ‘Replacement’ field empty in more than one rule.

But finally I can make it work very well today by just replacing with invisible items such as <!-- Filtered Ads1 -->, <!-- Filtered Ads2 --> and so on…
So replacing text with a blank field is a problem, but not replacing it with an invisible item. It’s a great new for me and it may also be good to know for every Text Obfuscator users encountering same kind of problems. 😉

One more time, thanks a lot Jonathon!

Posted on 30th Mar 2011 at 1:48 pm by OrdiFacil'.

Another blog, another problem… Please have a look when you’ll have some time:
http://wordpress.org/support/topic/plugin-text-obfuscator-error-message-foreach-line-212

Posted on 10th Apr 2011 at 12:21 am by OrdiFacil'.

Thanks for bringing that to my attention. I’ve posted a reply over on the WordPress forum. I hope that helps you!

Posted on 13th Apr 2011 at 11:24 am by ConfuzzledDuck.

You’ve solved the problem. Maybe should I say “as usual”, lol.
Thank you Jon!

Posted on 20th Apr 2011 at 10:32 am by Ordifacil'.

Waiting impatiently for the next release. I would be pleased to be a beta tester. Please let me know if you need anything I could do…

Posted on 6th Jun 2011 at 1:14 pm by Ordifacil'.

Would be able to add a wildcard feature soon? Keep up the good work 🙂

Posted on 22nd Aug 2011 at 5:08 pm by Jenning.

Yes. That’s very much on my roadmap, although I can’t give a clear indication of time just yet. It will be one of the features in 1.3.

Posted on 23rd Aug 2011 at 6:25 pm by Jonathon.

Just discovered your plugin and think it’s perfect for what I need. Wondering if you have an importable thesaurus to save adding words etc manually?

Cheers
KevD

Posted on 9th Jan 2014 at 12:23 pm by KevD.

That’s an interesting thought. No, currently there isn’t the ability to import or export rules but I like that idea. I might take a look at the plugin again with the thought of adding that in (as well as making sure it’s still working with the latest versions of WP).

Glad it’s useful for you 🙂

Posted on 10th Jan 2014 at 8:12 pm by Jonathon.

Thanks Jonathon. Yeah, would be good if we can import something. I sometimes use WP-Thesaurus by SoftWarp, but its a bit aggressive sometimes.

If you do manage to make any updates that include a thesaurus import, would you be kind enough to drop me an email? I’d appreciate it.

Thanks again for a great plugin. All the best.

Cheers
KevD

Posted on 14th Jan 2014 at 9:54 am by KevD.

Leave a comment