# Stop WordPress Guessing URLs on 404 Pages

> Turns off the automatic redirect WordPress makes when a URL does not exist but looks similar to a post slug, so wrong URLs show a real 404.

- Type: PHP
- Runs: Run everywhere
- Category: [Disable Features](https://wpide.com/library/category/disable-features/)
- Tags: disable, 404, redirects
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/disable-404-url-guessing/

## Code

```php
add_filter( 'do_redirect_guess_404_permalink', '__return_false' );
```

## Notes

Useful when the guessing sends visitors to unrelated pages.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Stop WordPress Guessing URLs on 404 Pages" 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/
