functions.phpに追加
add_action('transition_post_status', function($new_status, $old_status, $post){
if($new_status == 'publish' && $old_status != 'publish'){
$slug = md5($post->ID);
$newpost = array();
$newpost['post_name'] = $slug;
$newpost['ID'] = $post->ID;
wp_update_post($newpost);
}
}, 10, 3);
※投稿IDのMD5値をスラッグに利用