function wpse_save_post_meta( $post_id ) {
// verify nonce
if (!isset($_POST['cpt_wpse_nonce']) || !wp_verify_nonce($_POST['cpt_wpse_nonce'], basename(__FILE__)))
return $post_id;
// check autosave
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return $post_id;
// check permissions
if ( 'wpse' == $_POST['post_type'] ) {
if ( !current_user_can('edit_page', $post_id) )
return $post_id;
} elseif ( !current_user_can('edit_post', $post_id) ) {