[wp-trac] [WordPress Trac] #36980: get_the_ID () if used outside of a loop returns first post ID

WordPress Trac noreply at wordpress.org
Tue May 31 23:43:58 UTC 2016


#36980: get_the_ID () if used outside of a loop returns first post ID
-------------------------------+------------------------------
 Reporter:  Themezly           |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  4.5.2
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by dd32):

 This is unfortunately something that I'm fairly certain a lot of themes,
 widgets, and plugins rely upon.

 For example, for a clearer version, on a static page - what would you
 expect `get_the_ID()` or `get_post()` to return in the sidebar?  I'm
 fairly certain a lot of items are expecting that to be the single page
 being viewed.

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


More information about the wp-trac mailing list