[wp-trac] [WordPress Trac] #64921: REST API POST /wp/v2/posts: Undefined property stdClass::$id (line 766)

WordPress Trac noreply at wordpress.org
Mon Mar 23 11:58:52 UTC 2026


#64921: REST API POST /wp/v2/posts: Undefined property stdClass::$id (line 766)
-------------------------------------+-----------------------
 Reporter:  swissspaceboy            |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  7.1
Component:  General                  |     Version:  4.7
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  rest-api
-------------------------------------+-----------------------
Changes (by westonruter):

 * version:  6.9.4 => 4.7
 * milestone:  Awaiting Review => 7.1


Comment:

 It's still an issue, though, as core should be more resilient to how
 plugins are filtering the post object being inserted. I'm assuming this is
 due to the plugin filtering `"rest_pre_insert_{$this->post_type}"`. It's
 clear that this is also closely related to code quality which would have
 been identified by implementing PHPStan static analysis (see #64898), as I
 can see many issues where assumptions are made about what types will be in
 `WP_REST_Posts_Controller`. So I'll make some type improvements and look
 at bypassing the unique slug check when there is no ID.

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


More information about the wp-trac mailing list