[wp-trac] [WordPress Trac] #23329: Deprecate is_main_query()

WordPress Trac noreply at wordpress.org
Wed Jan 30 23:12:06 UTC 2013


#23329: Deprecate is_main_query()
-------------------------+------------------
 Reporter:  ethitter     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  3.6
Component:  Query        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------

Comment (by johnjamesjacoby):

 This is an okay function with a unique use case.

 Like nacin noted, is_main_query() is explicitly intended to answer the
 question: "is the current global $wp_query object the one that WordPress
 created in the main query loop, or is it otherwise altered?"

 People misusing it isn't the reason to deprecate it (I.E. query_posts())
 -- neither is being able to use it out of order (I.E. current_user_can()
 before $wp->init()).

 Better error-handing/developer-feedback when misusing functions is great,
 but is_main_query() isn't any worse than query_posts() in this regard.

 If the day ever comes where we deprecate query_posts(), we would want to
 deprecate is_main_query() at the same time. Without query_posts() there's
 no natural way in WordPress core to stomp the main query.

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


More information about the wp-trac mailing list