# metricool/2.1.1/app/Support/Helpers/Uninstall.php

Metricool – Social media and site statistics, version 2.1.1. 48 lines.

- Page: https://pluginprobe.com/plugins/metricool/2.1.1/code/app/Support/Helpers/Uninstall.php
- Raw: https://pluginprobe.com/plugins/metricool/2.1.1/raw/app/Support/Helpers/Uninstall.php
- Modified: 2026-08-20T14:08:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/metricool/2.1.1/code/app/Support/Helpers/Uninstall.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Metricool\Support\Helpers;

use Metricool\Services\OptionsService;

class Uninstall
{
    private OptionsService $options;

    public function __construct(OptionsService $options)
    {
        $this->options = $options;
    }

    /**
     * Handle plugin uninstallation.
     * @internal Method is currently hooked as the uninstallation callback
     * {@see Plugin::boot}
     */
    public function handlePluginUninstall(): void
    {
        $this->deleteAllOptions();
        $this->deleteCapability();
    }

    /**
     * Delete all Plugin options from wp_options
     */
    private function deleteAllOptions(): void
    {
        $this->options->wipe(true);
    }

    /**
     * Remove the 'metricool_manage' capability from the administrator role if it exists
     */
    private function deleteCapability(): void
    {
        $role = get_role('administrator');
        if ($role && $role->has_cap('metricool_manage')) {
            $role->remove_cap('metricool_manage');
        }
    }
}

```
