Note: You can use this function in themes and plugins. However, if you use it in a theme, your post type will disappear from the admin if a user switches away from your theme.
When registering a post type, always register your taxonomies using the
taxonomies argument. If you do not, the taxonomies and post type will not be recognized as connected when using filters such as
pre_get_posts. This can lead to unexpected results and failures.
Even if you register a taxonomy while creating the post type, you must still explicitly register and define the taxonomy using register_taxonomy().