Remove visibility for custom post type

I would like in my plugin to make a custom post type only in admin.
When I register my cpt, I do this :

$args = [
‘public’ => false,
‘publicly_queryable’ => false,
];
register_post_type( $post_type, $args );

It seems to be correct but when I edit it, I can still modify the visibility.

How can I remove the visibility for this custom post type ?

Read more here:: Remove visibility for custom post type

Leave a Reply

Your email address will not be published. Required fields are marked *