You need to set argument public
to false at register_post_type() function.
Whether a post type is intended to be used publicly either via the
admin interface or by front-end users. Default: false
- ‘false’ – Post type is not intended to be used publicly and should generally be unavailable in wp-admin and on the front end unless
explicitly planned for elsewhere.- ‘true’ – Post type is intended for public use. This includes on the front end and in wp-admin.