Title: Filter post content
Last modified: August 18, 2016

---

# Filter post content

 *  Evan
 * [21 years, 11 months ago](https://wordpress.org/support/topic/filter-post-content/)
 * How do I apply a filter to content when it’s posted or edited?
    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [stevarino](https://wordpress.org/support/users/stevarino/)
 * (@stevarino)
 * [21 years, 11 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68160)
 * Action hooks!
    [http://wiki.wordpress.org/Plugin/API](http://wiki.wordpress.org/Plugin/API)
   I think `add_action('publish_post', 'my_function');` is what you want. I believe
   there is a bug that trips this when a post is published AND edited… I might be
   wrong, so you could also try `add_action('edit_post', 'my_function');`. Using
   both wouldn’t hurt. 🙂
 *  Thread Starter Anonymous
 * [21 years, 11 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68210)
 * Thanks!
 *  Thread Starter Anonymous
 * [21 years, 11 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68212)
 * OK, so I’ve created the plugin, made a function, and declared add_action on publish_post—
   how do I access the post title and post body in the function?
    (By the way, what
   I’m trying to do is convert a few windows-1252 characters that frequently show
   up on our blog — such as em-dash and smart quotes — into UTF-8.)
 *  [kalico](https://wordpress.org/support/users/kalico/)
 * (@kalico)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68600)
 * This seems to be the only post that comes close to what I want to do, but frankly
   I dont’ get it! :\
 * What I want to do is simply change bad words to asterisks or otherwise blot them
   out in ALL posts — or moderate posts that have them.
 * I want to create an open forum where anyone can post (not just comment), but 
   the filters built into WP are only on comments, not posts.
 * I have downloaded Dougal’s pirate filter (so very cool! :)), but it seems to 
   only work on a per-post basis (or at least, that is all the instructions explain).
   I want something for all posts. I like the moderation fucntion on comments in
   WP, but is there a way to apply it to posts?
 * Marci 🙂
 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68601)
 * _I have downloaded Dougal’s pirate filter (so very cool! :)), but it seems to
   only work on a per-post basis_
 * It means that you could disable/enable for each individual post, instead of automatically
   applied to all posts.
 * There’s also another plugin
    [http://www.coffee2code.com/archives/2004/06/29/plugin-text-replace/](http://www.coffee2code.com/archives/2004/06/29/plugin-text-replace/)
 *  [kalico](https://wordpress.org/support/users/kalico/)
 * (@kalico)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68602)
 * PERFECT! Thanks for the link to Scott Riley’s plugin. It’s just what I needed
   for really simple post filtering. In fact, I even added a bit to it with an extra
   filter on the post title:
 * ‘add_filter(‘the_title’, ‘c2c_text_replace’, 2);’
 * I’m sure the pirate filter would have worked great too, and maybe now that I 
   have more of a clue how this works, I can still use it. Or just enjoy a pirate-
   y day every september. 🙂
 * Thanks again!!!
 *  [dp76](https://wordpress.org/support/users/dp76/)
 * (@dp76)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68609)
 * Any comments about add_filter(‘the_posts’, ‘my_functions’);
    ?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Filter post content’ is closed to new replies.

## Tags

 * [content](https://wordpress.org/support/topic-tag/content/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [output](https://wordpress.org/support/topic-tag/output/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 5 participants
 * Last reply from: [dp76](https://wordpress.org/support/users/dp76/)
 * Last activity: [20 years, 4 months ago](https://wordpress.org/support/topic/filter-post-content/#post-68609)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
