Wordpress - How can I edit post data before it is saved?

The wp_insert_post_data filter can do that:

add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 );

function filter_post_data( $data , $postarr ) {
    // Change post title
    $data['post_title'] .= '_suffix';
    return $data;
}

Use filter content_save_pre exactly like the_content -- the difference is that it operates when a post is saved, rather than displayed.

http://codex.wordpress.org/Plugin_API/Filter_Reference/content_save_pre


You can also check for the hook pre_post_update

add_action('pre_post_update', 'before_data_is_saved_function');

function before_data_is_saved_function($post_id) {

}