php - WordPress - enable or disable custom post typesfrom dashboard

one text

I'm creating a wordpress plugin. The plugin will register some custom routes in the REST api and some custom post types. Is possible to add a way to let the user enable or disable CPT and eventually create new CPT?

EXAMPLE

    public function create_new_cpt( WP_REST_Request $request )
    {
        $args = $request->get_param('newCptDetails');

        $cpt = register_post_type( 
            $args['name'], 
            [
                'label' => $args['label'],
                'description' => $args['desc'],
                'show_ui' => true,
                'show_in_menu' => true,
                'show_in_rest' => true
            ]
        );

            add_option( 'cpt_name', $args['name'] );
            add_option( 'cpt_label', $args['label'] );
            add_option( 'description', $args['desc'] );
            return $cpt;

    }

Source