[wp-trac] [WordPress Trac] #40626: Revisions API do not initialize GLOBALS['post']

WordPress Trac noreply at wordpress.org
Mon May 1 21:51:24 UTC 2017


#40626: Revisions API do not initialize GLOBALS['post']
--------------------------+------------------------------
 Reporter:  pdufour       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Description changed by ocean90:

Old description:

> Calling functions like `get_post()` do not work within the Post Revisions
> API endpoint since they don't have a line like `$GLOBALS['post'] =
> $post;`m which the posts controller does have
> https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-
> api/endpoints/class-wp-rest-posts-controller.php#L1381-L1383

New description:

 Calling functions like `get_post()` do not work within the Post Revisions
 API endpoint since they don't have a line like `$GLOBALS['post'] = $post;`
 which the posts controller does have
 https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-
 api/endpoints/class-wp-rest-posts-controller.php#L1381-L1383.

 Fix if I understand the issue would be to add those two lines to
 `prepare_item_for_response` in the revisions controller.

--

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


More information about the wp-trac mailing list