Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm sending the content of a custom post type in a plaintext email (it's to send competition entries to a panel of judges), so I need to make sure that $post->post_content is correctly sanitised first.

Is there a filter I can use for this, or if not, what sanitisation do I need to do?

Update: I've just found wp_strip_all_tags in wp-includes/formatting.php, is this what I need?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You will want to use sanitize_email();

return( sanitize_email( $email ) );

Here is the Codex link so you have it: http://codex.wordpress.org/Function_Reference/sanitize_email

Cheers!

share|improve this answer
    
that's great thanks, exactly what i was looking for –  Simon Blackbourn Apr 7 '12 at 12:57
    
Yeah, in the Professional WordPress Plugin Development by Wrox it explains in detail why it's best to use the sanitize_email function. There's also a validation function is_email which is really cool too. Cheers! –  David Apr 7 '12 at 17:49

Your Answer

 
discard

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.