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

WordPress Trac noreply at wordpress.org
Sun May 7 05:29:05 UTC 2017


#40626: Revisions API do not initialize GLOBALS['post']
-------------------------------------------------+-------------------------
 Reporter:  pdufour                              |       Owner:  jnylen0
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  4.7.5
Component:  REST API                             |     Version:  4.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  refresh                                        |
-------------------------------------------------+-------------------------

Comment (by joehoyle):

 Unless it's needed, I'm not sure _why_ we would want to add this. I
 believe they are there in the Posts Controller because there's some
 internal WP functions that require these globals to be set, so we had to
 make $post global. If that's not explicitly needed in the revisions
 endpoint, I don't think we should add it. All filters in the Revisions
 controller should get passed the Request or WP_Post object, so I'm not
 sure why you'd want to do `get_post()` with not ID param.

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


More information about the wp-trac mailing list