function microblog_update_slug( $data, $postarr ) {
if ( get_post_type() ==='microblog' && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
$data['post_name'] = sanitize_title( $data['post_title'] );
}
return $data;
}
add_filter( 'wp_insert_post_data', 'microblog_update_slug', 99, 2 );
Based on https://wordpress.stackexchange.com/questions/52896/force-post-slug-to-be-auto-generated-from-title-on-save and also https://stackoverflow.com/questions/30844401/wordpress-function-to-effect-only-one-custom-post-type-and-not-every-post