WordPress スラッグを自動的にpost_IDに変更する

WordPress
<?php
add_filter('wp_unique_post_slug', 'change_slug_to_post_id', 10, 4);

//スラッグを自動的に記事IDにする
function change_slug_to_post_id($slug, $post_ID, $post_status, $post_type) {
  if ($post_type !== 'page') { // この条件は任意で
    $slug = $post_ID;
  }

  return $slug;
}