[wp-trac] [WordPress Trac] #30970: setup_postdata should be able to accept a Post ID, currently requires full WP Post object

WordPress Trac noreply at wordpress.org
Sat Jan 10 18:10:44 UTC 2015


#30970: setup_postdata should be able to accept a Post ID, currently requires full
WP Post object
------------------------------------------+------------------------------
 Reporter:  sc0ttkclark                   |       Owner:
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Posts, Post Types             |     Version:  1.5
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by sc0ttkclark):

 I'll work up the unit tests, etc.

 I think at the same time, what should be happening is the global $post be
 set from setup_postdata too, since setup_postdata sets all other globals,
 but leaves out the $post global itself.

 I further propose we add a global $post set from the $post variable sent
 to setup_postdata, and after the local $post is setup if ( ! ( $post
 instanceof WP_Post )

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


More information about the wp-trac mailing list