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 have a custom front end form which creates a custom post type post and have just discovered WordPress automatically escapes $_POST data in the same way that Magic Quotes does.

I have Magic Quotes disabled and have created a test form that I run on the same domain. When run on it's own, no data is escaped. However when I run it as a page template for a WordPress page the raw $_POST data is escaped, i.e. using print_r($_POST) so before there has been any processing done.

I have also tried this with multiple themes and the same result.

Anyone know where / how to shut this off? Is there a filter I can suppress for this form?


share|improve this question

No, but you can just run stripslashes on it.

share|improve this answer
Yeah thanks, I've done that already. Wanted to overide it because of all the reasons not to use Magic Quotes but I guess in WP the environment is always the same so it's not the same issue... – patnz Nov 27 '11 at 22:57

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.