[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
Wed May 11 11:46:12 UTC 2016


#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:  Future
Component:  Query                              |  Release
 Severity:  normal                             |     Version:
 Keywords:  needs-testing ongoing needs-patch  |  Resolution:
                                               |     Focuses:
-----------------------------------------------+---------------------------

Comment (by Mekku):

 Replying to [comment:22 hungpham]:
 > I am just facing to this trouble in version 4.4.1, and wondering how it
 is going? Had to change the $context in my meta_box to "normal" or keep
 default setting "advanced".

 My temporary solution is to add the following code in the same
 function/method that registers the metaboxes:

 {{{#!php
 // the fix
 global $post, $wp_query;
 $wp_query->post = $post;

 // add metaboxes
 add_meta_box(...)
 add_meta_box(...)
 }}}

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


More information about the wp-trac mailing list