Thread: Wordpress Gurus
View Single Post
Old 04-30-2012, 05:52 AM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
you want wp_insert_post_data

i did this, so when you publish a post it took you back a year ;)

Code:
function back_to_the_future($data,$postarr) {
    	$format = 'Y-m-d H:i:s';
	$old_date = $data['post_date'];
	$old_date_gmt = $data['post_date_gmt'];
    	$new_date = date($format, strtotime('-1 year',strtotime($old_date)));
    	$new_date_gmt = date( $format, strtotime('-1 year',strtotime($old_date_gmt)));
	$data['post_date'] = $new_date;
	$data['post_date_gmt'] = $new_date_gmt;
    	return $data; 
} 

add_filter('wp_insert_post_data','back_to_the_future',99,2);
in your case you would want to use post_content

like so

Code:
function change_post_content($data,$postarr) {
        $post_content = strip_tags($data['post_content']);
	$data['post_post_content'] = $post_content;
    	return $data; 
} 

add_filter('wp_insert_post_data','change_post_content',99,2);
which would strip html tags from post content, etc.

this will get you started.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote