[wp-trac] [WordPress Trac] #18408: Can't wp_reset_postdata after custom WP_Query in an admin edit page

WordPress Trac noreply at wordpress.org
Tue Mar 10 18:26:15 UTC 2015


#18408: Can't wp_reset_postdata after custom WP_Query in an admin edit page
-------------------------------------------------+-------------------------
 Reporter:  ericlewis                            |       Owner:  ericlewis
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Query                                |  Review
 Severity:  normal                               |     Version:  3.8.1
 Keywords:  has-patch needs-testing 2nd-opinion  |  Resolution:
                                                 |     Focuses:
-------------------------------------------------+-------------------------

Comment (by brettshumaker):

 I just ran into this inconsistency for a plugin I have that's doing some
 things in the admin bar. Originally it was only pulling a list of pages
 and adding their edit links to an admin bar item, but I had a feature
 request for the ability to add other post types to this item. I was doing
 so with `WP_Query` but found that it was breaking the edit screen in that
 the editable content was being pulled from the last post in my list of
 items in the admin bar. I thought that `wp_reset_postdata()` wasn't
 functioning properly at first but then realized what was going on.

 I agree with @boonebgorges and @misternifty that this does need to be
 fixed so that the main query behavior is consistent across the admin area.
 It doesn't make sense for `WP_Query` to work on some but not all pages.

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


More information about the wp-trac mailing list