[wp-trac] [WordPress Trac] #34266: Support for ranges in WP_Query

WordPress Trac noreply at wordpress.org
Mon Oct 12 18:10:11 UTC 2015


#34266: Support for ranges in WP_Query
-----------------------------+------------------------------
 Reporter:  dziudek          |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Query            |     Version:  trunk
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by boonebgorges):

 Hi dziudek - thanks for the interesting suggestion!

 Like akibjorklund, I'm curious about the use cases for this. I would think
 that the more common use for "between" logic would use *dates* as the
 endpoints. This is already possible:

 {{{
 $q = new WP_Query( array(
     'date_query' => array(
         'column' => 'post_date_gmt',
         'relation' => 'AND',
         array(
             'after' => '2015-01-01 00:00:00',
         ),
         array(
             'before' => date( 'Y-m-d H:i:s' ),
         ),
     ),
 ) );
 }}}

 or whatever. Of course, this requires that you know the dates in question,
 and that your data is regular enough that dates will be a sufficient
 sorting mechanism.

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


More information about the wp-trac mailing list