[wp-trac] [WordPress Trac] #16798: Admin bar edit action is affected by query_posts, tax_query

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 24 18:58:32 UTC 2011


#16798: Admin bar edit action is affected by query_posts, tax_query
----------------------------+------------------------------
 Reporter:  kanuck54        |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.1
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------------------

Comment (by nacin):

 If you use new WP_Query(), use wp_reset_postdata() to restore the globals.

 If you use query_posts(), use wp_reset_query() to restore the query and
 the globals.

 I think the patch is on the right track, but I'm not sure it's catching
 the right situation. Would it make more sense to use `$wp_the_query->
 get_queried_object()`, perhaps? Or rather, `if ( ! is_main_query() )
 wp_reset_query();`

 query_posts() is used all the time, and not particularly often does the
 page change so much that the Edit link is no longer out of place. (I would
 guess, anyway.)

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


More information about the wp-trac mailing list