Word Replacer WordPress Plugin

Update

Version 0.2.3 is available at WordPress.org
Please install/upgrade from your wp-admin or download from WordPress.org
Thank you.

Oct 23, 2011


Word Replacer is a WordPress plugins to replace any desired text/word with your choice. You can filter which content to be replaced, eg. only in page, comment, or post. With very userfriendly administration page you can manage list of word eaasily. It’s also can be used to censor any bad/vulgar words in your comment your your guest posting. It’s simple but useful.

Features

  1. With regex support.
  2. Userfriendly administration page.
  3. Define yourself what word to replace in where. (e.g. a word shoud be replaced in comment but not in post etc)

Changelog:

version 0.2.1

  • Changed: original and replacement field in database is now TEXT type instead of VARCHAR
  • Fixed: plugins will analyze first whether original value in databse is base64 encoded (bug in version 0.2, when upgrade from version 0.1)

version 0.2

  • Regex support
  • Some bug fixes
  • Changed: Now using preg_replace PHP functions, instead of str_replace
  • Added: Replace title and page title
  • Added: Search whole word only
  • Added: Search case insensitive
  • Added: Contextual help
  • Changed: Original words saved to the database is now base64 encoded, to keep character consistency.
  • Added: Expand/collapse options page
  • Removed: initial word value (badword/good word)

version 0.1

  • First release

Screenshot:

Options page:

Help:

Options page (expanded):


Feature Wishlist

Here are  some feature wish lists for Word Replacer Plugin based on user comments:

  • Replace the title
  • Replace Case-insensitive

Uploaded to WordPress.org

This Word Replacer Plugin just approved and uploaded to WordPress Plugins Directory
Please see it in action, here.. http://wordpress.org/extend/plugins/word-replacer/ :D

Note: This post was posted by WP Sub Post Plugin

$10.99 .CO Domains!

Incoming search terms:

  • word replacer
  • wordpress replacer
  • word to wordpress plugin
  • wordpress word plugin
  • wordpress plugins replace strings with variables
  • wordpress remove specific word from title
  • wordpress word eklentisi
  • wordpress change word
  • wordpress comment vulgar words
  • wordpress comments bad word regular expression
  • http://ianbali.wordpress.com ianbali

    wah keren bang plugin nya…

    ijin nyimak

  • http://sendaljepit.net/ bangbambang

    mantab gan…
    di wp.org dah diaplot belum nih?

    • takien

      udah bro, barusan aja selesai commit ehehe. (lihat sub post diatas)

  • http://www.growingupawesome.com Sean

    Very good job. Works great!

    One suggestion: perhaps providing a checkbox to make the “badword” not case sensitive. As it is right now, “badword” is filtered and changed to “goodword”, but “bAdword” is not. Thanks!

    • takien

      Thanks Sean,
      added to Feature Wishlist :)

  • Pingback: Neue Wordpress Plugins 05/2010 | Wordpress, Plugin, Autor, Homepage | sohneinesschwaben.de

  • http://www.TOPCHEFVSHELLSKITCHEN.TK Charleen Knoepke

    I like the layout of your blog and I’m going to do the same thing for mine. Do you have any tips? Please PM ME on yahoo @ AmandaLovesYou702

    • takien

      hi, Charleen Knoepke
      it’s quite easy i think,
      I just saved this page from php.net website,
      added some php code on it and uploaded as my wordpress theme…

  • Gale

    Great plugin!
    I really hope to see the new version with word replace fot Title and case insentivie!! I really need it!!!

    • takien

      Thanks Gale, but I am very busy right now, may be in the next couple of days.

  • kate

    1. Could we remove the first line: “badword => goodword”. The heading already tell us how to use it.

    2. When adding more fields, could we not reset the form. Just a suggestion, use the html create node and append child (can’t remember the exact name) functions to dynamically create the input fields and check-boxes when needed.

    • takien

      Thanks kate for using this plugins :)

      1. Actually you can only remove it from database (e.g using phpMyadmin etc), but unfortunately this plugin require an initial value, otherwise it will return error…. yeah.. this is a bug at this version…

      2. No, adding a field will not reset the form… field are added on the fly using JavaScript.

  • http://blogiskewl.com blogiskewl

    Hi, I recently started a bloghosting platform (based on wordpress MU) and when I stumbled your blog I paid attention to your theme (looking good) so I was wondering can you tell me is it custom made theme or one of those free ones? thanks in advance! regards, blogiskewl

  • Hikari

    Any possible to Do with Unicode?
    When I try with this plugin, it show ??? only.

    Thanks

    • takien

      Hello Hikari, I’m sorry currently I don’t use Unicode, but I will learn more about this.
      Thank you.

    • phil

      That has to do with your database.
      I had the same issue.
      Log into PHPMyAdmin and change the “Collation” to “utf8_general_ci”

      your webhost’s default Collation is set to something other than the preferred default “utf8_general_ci” my american webhost’s default was set to.. latin1_SWEDISH_ci
      yes really… like WTF… anyway, do the changes and you should be fine. I have no more issues.

      • takien

        hahaha, thanks phil

  • the_beginner

    hi
    i find a bug in you nice Plugin , if i test your Plugin offline it is ok but if I use it on my webspace than will be follow think happen I write and after update i got this
    always if i use this ” than i got this \” can you please explain how can i fix this??

    thank you.

    • takien

      Sorry so sorry, don’t really know about your question, please give me detailed info.
      However I have tested it in several server and works fine both when replacing single quote (‘) and double quotes (“).

      Thank you

  • the_beginner

    ok wenn i use a adress like *ttp”:*** than got *ttp:\***
    always one \ if i update again than :\\** and so on after 10 words :\\\\\\\\\\***
    I dont know why , i just make a clean install i you like to test send me a mail you got the date for the test acount… for testing

    Thank you

    • takien

      Okay, check your mail inbox, thanks.

    • takien

      Hi the_beginner,
      It seems `magic_quotes_gpc` in your php settings is ON
      you should set it OFF to fix this problem.

      • takien

        It’s now fixed

        just change two lines
        before
        [php]
        if(isset($_POST['submit'])) {
        $id = $_POST['id'];
        $original = $_POST['original'];
        $replacement = $_POST['replacer'];[/php]

        after:
        [php]
        if(isset($_POST['submit'])) {
        $id = $_POST['id'];
        $original = stripslashes_deep($_POST['original']);
        $replacement = stripslashes_deep($_POST['replacer']);[/php]

        many thanks to you the_beginner, for reporting this bugs. :)

        • Anton

          I have replaced the two lines but the programm crashes. I am a complete php noob. Could someone send me the working version.

          Thank you.

          Anton

          • takien

            Thanks, anton.
            please reinstall your plugins, and edit the code carefully.

            to All:
            I’m sorry it’s too late to reply at this post because of my business.

  • the_beginner

    @takien thank you for the fix now it is working here on my server :-)
    Important for using Wordreplacer > here
    If you have a word “test” <a href….
    and you have like this in your text (html code) "Get the latest Flash Player" than you get this Get the 'la "here is now your link" Flash Player'
    But if you write in your database " test " with a space befor and after the word than works good :-)

    • takien

      You’re right the_beginner,
      by default, str_replace() function will replace all occurences in the string given, even if it’s only a part of word.

      However I am currently working on this plugin for next release, I use preg_replace() rather than str_replace() because preg_replace() is more flexible.

      The preview of next relase is: Regex support, case insensitive, replace title, and of course as you said “search whole word only”.

      I worked hard last night dealing with Database upgrade process in this plugin. Hahaha.. It was confusing for me because this is my first plugin that using sparate mysql table…. and finally it’s done.

      Thank you for your comment,
      all other idea/suggestion/feature request will be much appreciated.

      Regards,

  • http://DjSmuggla.com DjSmuggla

    Hi takien, for some reason i cant get it to work on my blog:
    DjSmuggla.com

    Whenever i put a badword in the left box & a goodword in the right, & click Add/UpDate Words nothing happens.
    The word doesn’t get replaced…

    Do you know why m8?

    I really want to use this aswell…

    • takien

      Thanks DjSmuggla, what do you mean with The word doesn’t get replaced…
      you have to check which one to be replaced, Posts, Comments or Pages

  • 486

    Will you release the next version soon?

  • phil

    hello taiken,

    has “replacing titles” been implemented ?
    I’m waiting for this or I can’t seem to get it to work.

    Thanks,
    Phil

  • Karel

    I tried to change a common word to change in a word Could it be done? Because I get two backslahses in the http part.

  • http://www.cihadsevim.com Cihad Sevim

    Hi,

    I am a news blogger from Turkiye. I have a problem about your plugin.

    My blog’s language is Turkish therfore i am using special Turkish characters. This plugin cannot support them.

    For example i can replace “Saadet Partisi” with “Saadet Partisi” but i cannot replace “Numan Kurtulmuş” with “Numan Kurtulmuş

    Thank you for your unique plugin.

    Regards, Cihad.

    • takien

      Thanks Cihad Sevim,
      I’m so sorry, actually I never dealing with Turkish character and other than Latin, but you can still browse to the source code of the plugin, and ask to fix it yourself or ask your friends who’s familiar with Turkish character.

  • Suzie

    Hi I love the idea of this plugin, but have tried it on wp2.84 and wp3.01 and get the same problem.
    When I go to “Add more fields” initially, I get the yellow triangle at bottom of screen and “Error on page” – This button is not doing anything.
    I type in a bad word, and a good word, select “posts” and click the blue “add/update word” button, and this button refreshes nothing happens – it still just shows goodwords and badwords.
    Template is eximius.
    Can you help me please? thanks!

  • Suzie

    PS, I get the same problem with wp 2.92 too :-(

    Hope you can help :-)

    • Hes

      @Suzie: That ‘s a bug. Just add a second pair of words BEFORE You try to save and everything will work fine.

  • xkyledubx

    This does not even work for me.

    • takien

      please specify your problem. thanks

  • http://www.rc-radiocontrol.com Santiago

    Hi

    Thanks for your great Word Replacer Plugin.

    Only one Think
    Will be possible the “Find exact word” Facility

    Thanks
    Santiago

    • takien

      please wait the release of version 0.2, I’m working on it right now.
      Thank you :)

  • Hes

    Hi there,

    the plugin did not save the words, that I’ve put into the fields in the backend of WP. A friend of mine discovered why:

    One of your loops (at line 52) should look like this:
    for ($i = 0; $i < $numfield; $i++) {

    but it actually looked like this:
    for ($i = 1; $i <= $numfield; $i++) {

    Best wishes, Hes

    • takien

      I am looking for it. Hope this will be fixed in version 0.2
      Thank you.

  • Siva

    Hi. One of my friends has added your plugin. It worked fine for the default post. I mean, the_content() function will be taken over by your plugin and does what expected. I have other customized post boxes which are exactly similar to the regular wordpress’s post box. Those contents are independent and can’t be fetched using the_Content() function. I want your plugin to apply for those customized post boxes as well. I have a clue that I believe it will work. If I club all those contents in all the post boxes in one, I can fetch the same using the_Content() function which is already picking up by your plugin. Please let me know your thoughts asap. Thanks again. Please refer the screenshot of my post page. http://i.imgur.com/nqo2a.jpg

    • takien

      hello Siva,
      I’m so sorry, this plugin is currently support only on default post ( not custom post type ), but don’t worry I will try to added the feature in next release.

      Thank you.

  • alan

    does not save so don’t work!

    • takien

      Please specify your problems
      thank you :)

  • http://www.tashan.tk Deepak

    Hey Takien,

    Pease add the Title Replace feature i really really need it and add an extra function like your plugin work with with a word list in txt format and replace words like bad –> good

    • takien

      A word list in txt file would be good idea, I will try to add it.
      But right now I’m focusing on release version of 0.2 with replace title, regex and few bug fixes, please wait on couples of days to be released. I’m testing it right now.
      Thank you :)

  • http://www.tashan.tk Deepak

    Aniway Thanks a lot there a re so many plugin out there but none is as easy as yours! great plugin!

    • takien

      Thank you Deepak :)
      Anyway version 0.2 would be better, please wait on couples of days to be released.

  • Luke

    Thank you so much for the plugin, it’s very neatly coded, easy to read and a pleasure to use. A couple of things thought:

    1.) Is it possible to make quotes possible in an upcoming version (I modded the script to do that in a different way than you sugggested above, but an official version would be nice).

    2.) If you have an original text and replacement similar to another original text the plugin will do weird things i.e.

    original #1 = butter
    replacement #1 = peanut butter
    original #2 = peanut butter
    replacement #2 = jelly

    Will cause all butter to be replaced as jelly AND all peanut butter be replaced as jelly. In order to avoid that you’d have to change the sequence and put #2 before #1.

    3.) Would be nice if there were some sort of caching so as not to add strain to the database.

    • takien

      Thank Luke :)
      1. Any your ideas would be greatly appreciated, If you have modded your own version, please notify me to be added to official version.

      2. Just in mind, that feature is possible to be realized by check first if the original is previously exists in another replacements. Not tried yet.

      3. I don’t have idea how to cache it yet. :( Although, might you could try to use third party caching plugin, such as W3 Total Cache

      Anyway thank you very much for your comment and feedback. Don’t miss the release of version 0.2, with few bug fixes and new features.

  • Katherine

    Hi Takien, your software is great, I am hoping that you can add 2 features in your word replacer plugin. I am willing donate $50 for “replace title” and another $50 for “replace tag” in the post. Please contact me. Thanks

    • takien

      Hi Katherine, thank you very much for your appreciation for this plugins.
      The version of 0.2 will be uploaded soon with replace title feature.
      I can’t promise that i will add replace tag, since I don’t know how it works, but don’t worry, I would try it.

      To make a donation, please refer to Donate links on this post.

      Thanks.

      • Katherine

        Hi again, I have donated $50 a while ago, just to try adding the function “tag replace” in the post. I hope you can create this add on. I badly needed it.

        Thank you.

        Katherine

        • Katherine

          Hi Takien, can you work with the tag replace feature? I am willing to pay you to work for this project for the tag replace feature. Please contact me asap. Thanks.

  • takien
  • Pingback: Word Replacer Wordpress Plugin | takien, not taken

  • http://www.oblomov.fr/ oblomov

    Your update v. 0.2.1 (today 01/01/2011) gives me an error message :

    Warning: array_diff() [function.array-diff]: Argument #1 is not an array in /web/oblomov/www/wp-content/plugins/word-replacer/word-replacer.php on line 56

    It has also erased all the previous settings.

    • takien

      it’s because you submitted form while there is no more fields. gonna fix this.
      thank you.

    • http://www.oblomov.fr/ oblomov

      I submitted what form ?
      Fields ?

  • http://www.niceplugins.com/ Nice Plugins

    Mancap ni bro… Banyak yg download :D

    - xrvel

    • takien

      thanks bro :)

  • http://www.goldfishcake.com alienman

    I had the same error. Also, the original words come out looking like random symbols when I try to submit the replacements in the plugin settings.

  • Marty

    Hi,
    I liked the description, i liked the lay out, I liked the easy of use, but I am still stupid enough, NOT to make it work.
    I installed, re installed, new domain, cmod, etc.

    Nothing happens/../../

    Help <- Replace with: Thnx for the Help~ ;-) Marty

    • takien

      What version of WordPress you’re using? I’m fix few bug in this version. I hope it will work fine to you :)
      Thank you.

      • http://411start.com Marty

        Using the latest version. update day to day! It’s more the complexity I think, and my capability…Probably the mix with a pre loaded theme.
        i will use it this weekend and send the errors to you on Sunday

        • takien

          version 0.2.2 is available, please upgrade/reinstall.

          • Mark

            Works great now. Thanks!

          • http://411start.com Marty

            yep works, however in combo with premiumpress shopper i still have errors on row 465, but thats premiumpress

    • takien

      hi Marty, could you specify the error message.
      give me a screen shot.
      thank you.

  • Bill

    Let me preface this comment with letting you know that I have little/no experience with PHP :)

    I love this plugin, but am having a problem with another plugin and this working together. I get an error – although I don’t think it’s affecting the site performance.

    The error is:
    Warning: array_diff() [function.array-diff]: Argument #1 is not an array in /home/content/myblog/wp-content/plugins/word-replacer/word-replacer.php on line 56

    I believe this is happening because the $original value must not be getting set. It appears that an attempt is made to set this variable if this is true: if(isset($_POST['submit'])) {

    The other plugin I’m using is BackWPup and the error happens when you schedule a backup and hit the “Schedule” button (which I believe is a “submit” button with a value of “submit”).

    I’m not sure if this is an easy fix or not, but I wanted to make you aware. I’m thinking I can either:
    A) do a check on $Original to see if it’s an array first
    B) change the if statement so it has another condition and doesn’t go into the loop
    c) modify the backup plugin to create the array somehow

    Other than that, your plugin is flawless! Great job!

    • takien

      this is a bug, I’m working on this right now. sorry for late approve your comment and reply.
      Thank you. :)

  • http://www.iptersdertsio.com Scott Bucheli

    Hi there! Do you use Twitter? I’d like to follow you if that would be ok. I’m absolutely enjoying your blog and look forward to new updates.

  • Mark

    Hi takien,

    I’m running wordpress 3.0.4 and version 0.2.1 of the plugin. I get the following error message when submitting comments:

    Warning: array_diff() [function.array-diff]: Argument #1 is not an array in …/wp-content/plugins/word-replacer/word-replacer.php on line 56

    Warning: Cannot modify header information – headers already sent by (output started at …/wp-content/plugins/word-replacer/word-replacer.php:56) in …/wp-includes/pluggable.php on line 890

    You can reload the page and the comment has been added and the plugin replaces words correctly.

    Thanks in advance.

    • takien

      this is a bug, I’m working on this right now.
      Thank you.

  • http://www.xhtmlbox.com Heri Hehe

    Hi, thanks for the great plugin.

  • Fuji

    My readers can add a website url and and website information to my website.

    The website url is automatically the title of a post (gravity form), but it contains http://www. or http://, I would like to strip them out so the title will be domain.com instead of http://www.domain.com

    Can I use the plugin to strip the data (replace with nothing)? and what code do i need to use? Will the permalink then also follow the title?

    • takien

      Hello Fuji,
      Haven’t you try it? It should ‘replace with nothing’ too.
      :)

  • jazzylee

    Not sure why it quit working on a 3.1 site.

    Would be nice if word / replacement pairs could be exported so other sites could be easily set up.

    • takien

      Hello jazzylee, it supposed to be working at 3.1
      export/import function? i think so :)

  • http://school.kharkov.ua Ivan

    Wonderful plugin, but there are problems with the Russian language. After saving, Russian letters are replaced by ????
    You can fix this?

  • http://school.kharkov.ua Ivan

    In phpmyadmin changed table encoding:
    ALTER TABLE wp_word_replacer CONVERT TO CHARACTER SET cp1251 COLLATE cp1251_general_ci
    It seems helped.

    • takien

      Thanks Ivan, hope this will help others with non latin characters :)

  • http://nomaas.org SJK

    Great plugin, but it’s not replacing the ‘name of the commenter’ if someone uses one of the specified words as their alias. It only works in body of the comment. Users can get around the word replacer, by just using the the banned words in their name.

    Help would be appreciated

    • takien

      Hello,
      thanks SJK for feedback and comment, I wondering if it’s possible. (thinking), theoretically it could be. :)

  • http://www.ordifacil.com/blog/ Ordifacil’

    Hi,

    the description looks promising. The only thing that makes me hesitate about installing it is my lack of knowledge with Regular Expressions.
    For example I’d like to replace all the content between “word1″ and “word2″ with your plugin so I’ve searched for more details on regex related forums or tutorials but I’m lost. So I wonder if there would be a way to add a wildcard capability to your plugin? (so we could use “word1*word2″ as the item to replace)
    By the way I also don’t know if it’s possible to replace something with… nothing (blank field). Of course I mean a kind of removing.

    Thanks for the time you’ve passed on this work, and above all for sharing it free to everyone…

    • takien

      Hello Ordifacil’,
      thank you for using my plugin and feedback.
      Sure, regex supports wildcard as well, you need to use (.*) dot and asterisk inside bracket.
      Example in the original field, you type word1(.*)word2 and in the replacer you type “and“.
      don’t forget check insensitive and regex.
      it will replace the original text: “this is my word1 some other text word2 example” with “this is my word1 and word2 example

      hope this help you.
      thanks.

      • http://www.ordifacil.com OrdiFacil’

        Sure, it helps me a lot. It opens my eyes to a wider perspective of all the great things I could do with this tool. Thanks a lot, Takien.

  • Tyler

    Man you should let the pluggin add many words at once. It’s too much work add 200 words one by one…
    Thanks.

    • takien

      Hello Tyler,
      thanks for your suggestion. :)

  • otong

    gan ini ga jalan di wp 3.2.1 ya?

    • takien

      jalan gan.. )

  • Moeghan

    aku pake WordPress 3.1.2 kuk gak jalan yah mas? Sumpah deh beneran gak jalan.
    Dulu masih bisa, sekarang dah gak bisa buat replace ’ menjadi ‘.

    Tulung mas di cek :D
    Terima Kasih.

    • takien

      masa sih gan, karakter apa itu?

      • Moeghan

        itu titik atas satu …
        example:
        don’t | we’ll

        jadi begini:
        don’t | we’ll

        aku gak ngerti itu karakter apa, tp plugin ini sungguh bermanfaat buat blog gw yg banyak mengandung karakter seperti itu, agar replacementnya berjalan otomatis, jika butuh info blog, silahkan PM atau email gw untuk detailnya :D

        • takien

          Hmm oke gan, nanti saya telusuri masalahnya ;)

  • Jens

    Hy takien,i have exactly the same problem. Well, it would be nice if the user could upload a list with badwords.

    Greetings from Germany

  • Fabrizio

    Hello Takien
    congratulations for the plugin.
    I have a problem. Should I use regex to substituted for all links starting with “http://www.aa*” in some html like “[jbutton color="rosy" icon="http://www.domain.image.cio" link="http://www.anotherfixdomain" size="large"]text here[/jbutton]”
    I don’t know regex syntax to set the function to be included in the original field. Can you help?

    • takien

      Use wildcard (.*) in your regex (original field).

      eg. http://www.(.*).com will match any domain with .com extension.

      Note: don’t forget to put end delimiter after wildcard, in this example i put .com. Otherwise, it will replace everything from http://www. until the end of the content.

      Thanks.

  • knn

    This is the best word replacer for wordpress, but unfortunately it doesn’t work in multisite/network mode.

    As far as I can see it’s a simple bugs (= easy fixable), so maybe you could take a look. I think it has something to do with the wrong linking when one clicks “add/update words”