[wp-trac] [WordPress Trac] #11461: When creating a new WP_Query, running the_post() on the new object resets global $post

WordPress Trac wp-trac at lists.automattic.com
Wed Dec 16 19:39:26 UTC 2009


#11461: When creating a new WP_Query, running the_post() on the new object resets
global $post
--------------------------+-------------------------------------------------
 Reporter:  bsdeluxe      |       Owner:  ryan      
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  Query         |     Version:            
 Severity:  normal        |    Keywords:  close     
--------------------------+-------------------------------------------------

Comment(by filosofo):

 I like the general idea of trying to move the WP_Query away from being
 overly dependent on globals.  Unfortunately there are huge backwards-
 compatibility issues.  Practically everybody assumes $post will be defined
 in the scope of a template file.  Lots of themes and theme examples use
 {{{$post->ID}}} to get the current post's ID within the Loop.

 Someday maybe.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11461#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list