# Skip Akismet Checks for Trusted Logged-In Users

> Stops sending comments from logged-in users who can edit posts (authors, editors, administrators) to Akismet, saving API calls and keeping staff replies out of the spam queue.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: akismet, comments, performance
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/akismet-skip-logged-in-users/

## Code

```php
add_filter( 'preprocess_comment', function ( $commentdata ) {
    if ( class_exists( 'Akismet' ) && is_user_logged_in() && current_user_can( 'edit_posts' ) ) {
        remove_filter( 'preprocess_comment', array( 'Akismet', 'auto_check_comment' ), 1 );
    }

    return $commentdata;
}, 0 );
```

## Notes

Change edit_posts to moderate_comments to trust only moderators and administrators.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Skip Akismet Checks for Trusted Logged-In Users" 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/
