[wp-trac] [WordPress Trac] #43502: `WP_REST_Posts_Controller::prepare_item_for_response()` doesn't reset postdata after calling setup_postdata()

WordPress Trac noreply at wordpress.org
Mon Apr 6 07:41:41 UTC 2026


#43502: `WP_REST_Posts_Controller::prepare_item_for_response()` doesn't reset
postdata after calling setup_postdata()
-------------------------------------------------+-------------------------
 Reporter:  gerbenvandijk                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  REST API                             |     Version:  4.9.4
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch needs-      |     Focuses:  rest-api
  unit-tests                                     |
-------------------------------------------------+-------------------------
Changes (by motylanogha):

 * Attachment "43502.6.diff" added.

 Refreshed patch for current trunk. Saves and restores $GLOBALS['post'] in
 prepare_item_for_response(), including the HEAD early return path.
 Includes 2 unit tests. All 283 posts controller tests pass.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43502>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list