[wp-trac] [WordPress Trac] #27015: WP_Query::get_queried_object() does not always work in 'pre_get_posts'

WordPress Trac noreply at wordpress.org
Thu May 29 21:19:08 UTC 2014


#27015: WP_Query::get_queried_object() does not always work in 'pre_get_posts'
----------------------------------------+------------------
 Reporter:  bcworkz                     |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  4.0
Component:  Query                       |     Version:  3.8
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------

Comment (by wonderboymusic):

 [attachment:27015.diff 27015.diff] combines the patches and makes the
 errors go away when the entire suite runs.

 The logic in this block `$this->get( 'pagename' ) || $this->get( 'name' )`
 is producing `null` for `$this->queried_object` and
 `$this->queried_object_id`.

 So, in your tests, make sure you are checking for not empty for those
 values.

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


More information about the wp-trac mailing list