Opened 8 years ago
Last modified 6 years ago
#37832 new defect (bug)
Using ?p=xxx on a posts page with an invalid post ID does not return a 404 status
Reported by: | smerriman | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
Steps to replicate:
- Create a page and set it as the posts page.
- Visit this page with ?p=123456 (an invalid ID) added.
WordPress will return whatever 'no results found' message you have in the theme, but with a 200 status.
The handle_404 function seems to have been set up to always give a 200 status if is_home() returns true. This should not apply if you're overriding the query in some way via the URL.
Somehow many of these URLs have been detected by Google on a site of ours and are being reported as soft 404s. How they were found is one thing, but WordPress should not be returning a 200 status regardless.
Change History (4)
Note: See
TracTickets for help on using
tickets.
Related: #7592, #22798, #22879, #23060.