# Keep Bots Out of Redirection's 404 Log

> Stops the Redirection plugin from logging 404s caused by crawlers and vulnerability scanners (wp-login probes, .env and .php file hunts), so the log shows only real broken links.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: redirection, 404, logs
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/redirection-skip-bot-404-logs/

## Code

```php
$wpide_noise = array( '.env', 'wp-config', '.php', 'xmlrpc', '/.git', 'phpmyadmin', 'wlwmanifest' ); // URL fragments to ignore.

add_filter( 'redirection_404_data', function ( $data ) use ( $wpide_noise ) {
    $agent = isset( $data['agent'] ) ? strtolower( (string) $data['agent'] ) : '';
    $url   = isset( $data['url'] ) ? strtolower( (string) $data['url'] ) : '';

    if ( preg_match( '/bot|crawl|spider|scan|curl|python|wget/', $agent ) ) {
        return false;
    }

    foreach ( $wpide_noise as $fragment ) {
        if ( false !== strpos( $url, $fragment ) ) {
            return false;
        }
    }

    return $data;
} );
```

## Notes

Add your own patterns to $wpide_noise.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Keep Bots Out of Redirection's 404 Log" 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/
