[wp-trac] [WordPress Trac] #23833: Add a unique ID or NAME to target queries .

WordPress Trac noreply at wordpress.org
Sat Apr 13 05:06:53 UTC 2013


#23833: Add a unique ID or NAME to target queries .
-------------------------+------------------------------
 Reporter:  krembo99     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------
Changes (by MikeSchinkel):

 * cc: mike@… (added)


Comment:

 Replying to [comment:4 prettyboymp]:
 > At this layer in the platform, the query_vars for a WP_Query instance
 should be explicit about what data the query will return.  When a WP_Query
 instance is made with a set of query_vars it should ALWAYS return the same
 data, regardless of the context.

 What justification do you have for ''"should ALWAYS?"''  I'm asking
 honestly, because at the moment I don't know what the justification for
 this would be but maybe I don't know what I don't know.

 Without knowing of a justification for why it would not be a good idea I
 can envision that contexts would be very helpful to change the output. For
 example a context of `'main-loop'` might return different values than a
 context of `'sidebar'` ''(I'm being convenient in my examples.)''

 Or do you simply mean that a context should be included in the query_vars?
 i.e.:

 {{{
 $my_query = new WP_Query(array(
    'context' => 'my_query_id',
    '...' => '...',
 ));
 }}}

 > Ideally, there should be a factory method for WP_Query....

 That sounds like it might meet the needs but it's not clear to me unless I
 could see the implementation and apply to some of my use-cases.

 BTW, I see a context as being used like classes in CSS, so there is a need
 to be able to have multiple contexts in a WP_Query if the use-case calls
 for it. :)

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


More information about the wp-trac mailing list