[wp-trac] [WordPress Trac] #41745: Uncaught Error in get_query_var when $wp_query is null

WordPress Trac noreply at wordpress.org
Thu Aug 31 11:51:27 UTC 2017


#41745: Uncaught Error in get_query_var when $wp_query is null
--------------------------+------------------------------
 Reporter:  kbjohnson90   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  4.8.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by kbjohnson90):

 Here is a reduced test case:


 {{{#!php
 <?php

 function my_plugins_loaded(){
     $posts = get_posts();
 }
 add_action( 'plugins_loaded', 'my_plugins_loaded' );

 function my_parse_query(){
     $var = get_query_var( 'foo' );
 }
 add_action( 'parse_query', 'my_parse_query' );
 }}}


 https://gist.github.com/kjohnson/c93e6d5701778149bcf53a8c11afe470

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


More information about the wp-trac mailing list