# metricool/2.1.1/app/Traits/HasNonces.php

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

- Page: https://pluginprobe.com/plugins/metricool/2.1.1/code/app/Traits/HasNonces.php
- Raw: https://pluginprobe.com/plugins/metricool/2.1.1/raw/app/Traits/HasNonces.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/Traits/HasNonces.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Metricool\Traits;

trait HasNonces
{
    /**
     * Method for verifying the nonce
     * @param mixed $nonce Preferably string, not type-casted to prevent errors
     */
    protected function verifyNonce($nonce, string $action = 'metricool_nonce'): bool
    {
        if (is_string($nonce) === false) {
            return false;
        }

        return (bool) wp_verify_nonce(sanitize_text_field(wp_unslash($nonce)), $action);
    }
}

```
