In WordPress, I want to change something in the post content before it gets stored in the database... How would I make WordPress send the content to my custom function before storing it in the database and then receive the modified content back to finally store it?
+1
A:
Filter functions do exactly what you are describing. The filter that runs prior to saving content to the database is content_save_pre
function make_all_caps($content){
return strtoupper($content);
}
add_filter('content_save_pre','make_all_caps');
Add the above to your funtions.php file, or include in a plugin and it will run right before the post content is saved to the db.
kevtrout
2010-08-24 18:14:37