title: Replace random word
body: <p>I want replace random word in WordPress post. I have a code for MySQL.
  This code working well:</p>
  
  <pre><code>update wp_posts set post_content =
  replace(post_content,'oldword','newword'); 
  </code></pre>
  
  <p>But when I want replace random in database like</p>
  
  <pre><code>replace(post_content,'oldword',rand('newword','google','stackoverflow','stackover')); 
  </code></pre>
  
  <p>This code not working.</p>
  
  <p>I don't know how use this code for random replace word.
  <strong>I want each occurrence of oldword to be replaced by a different word</strong></p>
  
  <pre><code> Error
  
  SQL query:
  
  UPDATE wp_posts SET post_content =
  REPLACE_RANDOM(post_content, 'oldword')
  
  MySQL said: Documentation 
  
   #1366 - Incorrect string value: '\xD8\xA7\xDB\x8C\xD9\x86...' for column 'String' at row 1
  </code></pre>
  
  <p>Where is the problem?</p>
  
  <pre><code>DELIMITER $$
  DROP FUNCTION IF EXISTS Replace_Random$$
  CREATE FUNCTION Replace_Random(String TEXT, Word TEXT)
  RETURNS TEXT
  BEGIN
  DECLARE New TEXT DEFAULT '';
  DECLARE Loc INT DEFAULT INSTR(String, Word);
  DECLARE WLen INT DEFAULT Length(Word);
  WHILE Loc DO
  SET New = CONCAT(New, SUBSTR(String, 1, Loc-1), ELT(FLOOR(RAND()*5)+1, 'biterrr', 'stackoverflow', 'serress', 'ms-ms-ms', 'Nick'));
  SET String = SUBSTR(String, Loc + WLen);
  SET Loc = INSTR(String, Word);
  END WHILE;
  SET NEW = CONCAT(New, String);
  RETURN New;
  END$$
  DELIMITER ;
  
  UPDATE wp_posts SET post_content =
  REPLACE_RANDOM(post_content, 'oldword');`
  </code></pre>