WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've built a small widget for my website
It has a couple of inputs, and a <textarea> among others.
Whenever someone inputs to the textarea it adds a tab at the begining
and changes every ' to \'
After a couple of times I save the same input,
I just get sentences that were

It's nice


It\\\\'s nice

the code for the Textrea:

         <textarea rows="5" cols="40" id="cat_<?php echo $i ?>_text" name="cat_<?php echo $i ?>_text">
        <?php echo $text ?>

Any ideas?

share|improve this question
up vote 1 down vote accepted

Try stripslashes to remove the backslash.

echo stripslashes( $text );

This is going to replace one slash per slashes group only though, you should first reset all the contents that have multiple slashes.

I guess the tab at the beginning is due to the fact that you jump a line before echoing the text. Try this instead :

<textarea rows="5" cols="40" id="cat_<?php echo $i ?>_text" name="cat_<?php echo $i ?>_text"><?php echo stripslashes( $text ); ?></textarea>
share|improve this answer
worked like a charm, thanks :] – Asaf Jul 14 '11 at 9:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.