I am trying to create custom taxonomy select box according through the post type.
It work at the first time add new post.
But when I publish the post, the taxonomy just went blank and don't have any value in the selector.
Because after publishing the post, there is no parameter post_type in the URL and the code will not work correctly. After publishing the post, there is the post ID in the URL and you can get the post type by using the WordPress function get_post_type().