views:

15

answers:

1

Hey all,

I was wondering if there was a method to do some of my own custom formatting before the post is saved to the database. I know how to customize it when its fetched, but I'd rather keep the reading performance high over the write performance.

Thanks, Matt

+2  A: 

You can create a plugin which you attach to content_filtered_save_pre or content_save_pre hook (see other hooks here http://codex.wordpress.org/Plugin_API/Filter_Reference)

naivists
Thanks! Is it possible to just add the hook to functions.php? I'm not really saavy with creating plugins (yet!).
Matt
I don't think you should do that. Whenever you upgrade wordpress, you will have to re-create changes you have made to functions.php! This is why they created the Plugin API and you should use it. There are very simple examples of how plugins can be created!
naivists
Okay. I was under the impression that plugins make graphical changes as well.. so they don't have to? Also functions.php in the theme doesn't change when you upgrade wordpress, does it? I realized that is run at runtime though. So the admin functions will be removed when you upgrade?
Matt
@Matt You can add this functionality to your `functions.php` file, just don't use the `default` WordPress theme folder for your theme. Only `classic` and `default` are changed when WordPress is upgraded. Anything you can do in a plugin, you can add to your `functions.php` file.
Doug Neiner
Great thanks a lot Doug!
Matt