# "Spam Blocked by Akismet" Counter Shortcode

> Adds a [wpide_akismet_count] shortcode that shows how many spam comments Akismet has blocked on your site, a small trust signal for footers and contact pages.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: akismet, spam, shortcode
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/akismet-spam-blocked-shortcode/

## Code

```php
add_shortcode( 'wpide_akismet_count', function ( $atts ) {
    if ( ! class_exists( 'Akismet' ) ) {
        return '';
    }

    $atts  = shortcode_atts( array( 'text' => '%s spam comments blocked by Akismet' ), $atts, 'wpide_akismet_count' );
    $count = (int) get_option( 'akismet_spam_count', 0 );

    if ( ! $count ) {
        return '';
    }

    return '<span class="wpide-akismet-count">' . esc_html( sprintf( $atts['text'], number_format_i18n( $count ) ) ) . '</span>';
} );
```

## Notes

Use [wpide_akismet_count text="%s spam comments blocked"]; %s becomes the number.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""Spam Blocked by Akismet" Counter Shortcode" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
