[wp-trac] [WordPress Trac] #37832: Using ?p=xxx on a posts page with an invalid post ID does not return a 404 status

WordPress Trac noreply at wordpress.org
Thu Oct 30 15:28:22 UTC 2025


#37832: Using ?p=xxx on a posts page with an invalid post ID does not return a 404
status
--------------------------+-------------------------
 Reporter:  smerriman     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Canonical     |     Version:
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+-------------------------
Changes (by SirLouen):

 * status:  new => closed
 * resolution:   => worksforme
 * component:  Posts, Post Types => Canonical
 * milestone:  Awaiting Review =>


Comment:

 == Reproduction Report
 === Description
 ⚠️ This report can't completely validate that the issue is happening

 === Environment
 - WordPress: 6.9-beta2-61080
 - PHP: 8.2.29
 - Server: nginx/1.29.3
 - Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 141.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.3
 - MU Plugins:
   * WooCommerce Analytics - Proxy Speed Module 1.0.0
 - Plugins:
   * Test Reports 1.2.0

 === Testing Instructions
 - First, I'm assuming that we have the permalinks set to anything other
 than the `plain` format, as it returns `404` as expected
 1. ❓ With any other permalink structure, inside the blog page, any query
 is considered a search and an invalid search returns a `200` with `Sorry,
 but nothing was found. Please try a search with different keywords.`
 message as expected

 === Actual Results
 1. ❌ Error condition is not occurring

 === Additional Notes

 If we do:
 `/test-page/?author=1`
 Being `test-page`, it will return all posts by this author
 Similarly if we do
 `/new-page/?author=2`
 Again it will return the `Sorry, but nothing was found. Please try a
 search with different keywords.` as this has not been found

 Doing this query, in any other post, not associated to the blog pattern,
 will return the canonical post as expected.

 Conclusion: Everything is working as expected. Closing this as
 `worksforme`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/37832#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list