Title: Queries
Last modified: August 20, 2016

---

# Queries

 *  [aalokdhond](https://wordpress.org/support/users/aalokdhond/)
 * (@aalokdhond)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/queries/)
 * Hi Stephen,
 * A small help required. M using Version 1.4.2 of event organiser. I require the
   following all events which start before today or start today and all events that
   end after today or today and of a paticular category.
 * Here is my code
    $events = eo_get_events(array( ‘showpastevents’=>true, ‘event_start_before’
   => $_REQUEST[“eventon”], ‘event_end_after’ => $_REQUEST[“eventon”], ‘ondate’ 
   => $_REQUEST[“eventon”], ‘group_events_by’ => ‘series’, ‘tax_query’=>array( array(‘
   taxonomy’ => ‘event-category’, ‘operator’ => ‘IN’, ‘field’ => ‘slug’, ‘terms’
   => $_REQUEST[“slug”] ) ) ));
 * this return all events where $_REQUEST[“eventon”] is the date and $_REQUEST[“
   slug”] is the category
 * $events = eo_get_events(array(
    ‘showpastevents’=>true, ‘event_start_before’ 
   => date(‘Y-m-d’), ‘event_end_after’ => date(‘Y-m-d’), ‘ondate’ => date(‘Y-m-d’),‘
   orderby’ => ‘eventstart’, ‘order’ => ‘DESC’, ‘group_events_by’ => ‘series’, ‘
   tax_query’=>array( array( ‘taxonomy’ => ‘event-category’, ‘operator’ => ‘IN’,‘
   field’ => ‘slug’, ‘terms’ => get_query_var(‘term’) ) ) ));
 * this shows me events that start from today :O .
 * Also if there is a event that reoccurs between 1st to 30th of a month weekly 
   on thursday then both of the above fetches the event for all days ??
 * I know im doing smthing wrong plz throw some light
    Plz help i have a deadline
   🙁
 * Aalok Dhond
 * [http://wordpress.org/extend/plugins/event-organiser/](http://wordpress.org/extend/plugins/event-organiser/)

Viewing 1 replies (of 1 total)

 *  [Stephen Harris](https://wordpress.org/support/users/stephenh1988/)
 * (@stephenh1988)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/queries/#post-3178000)
 * Hi Aalok,
 * I would remove the `ondate` parameter.
 * `event_start_before` etc are inclusive dates – so your second query for instance
   would fetch events that start on or before AND end on or after today (and also
   belong to some term). In effect this should return any events that are ‘running’.
 * _Also if there is a event that reoccurs between 1st to 30th of a month weekly
   on thursday then both of the above fetches the event for all days ??_
 * With `'group_events_by' => 'series'` then no, this should’t be happening.
 * I’ve tested the above query (without the taxonomy part) and it works fine for
   me (this was using 1.5.7 – but I’m not aware of anything that would mean it shouldn’t
   work in 1.4.2). That said, I’d recommend upgrading to the latest version anyway.
 * If the problem persists it could be due to another plug-in/theme (you can check
   this by disabling other plug-ins and switching to twenty eleven). There are other
   debugging steps you can take:
    -  Check the `$_REQUEST` values are being recieved
    -  Check the SQL statement by placing `var_dump($where)` just above [this line](https://github.com/stephenh1988/Event-Organiser/blob/1.4.2/includes/event-organiser-archives.php#L306).
      Feel free to post it here.
 * One thing that is odd is that you’re two examples are not consistent. On the 
   first you get all events, on the second you get events that start after today…
   If `$_REQUEST['eventon']` is set to today then these queries should be the same,
   no?

Viewing 1 replies (of 1 total)

The topic ‘Queries’ is closed to new replies.

 * ![](https://ps.w.org/event-organiser/assets/icon-256x256.png?rev=978123)
 * [Event Organiser](https://wordpress.org/plugins/event-organiser/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/event-organiser/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/event-organiser/)
 * [Active Topics](https://wordpress.org/support/plugin/event-organiser/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/event-organiser/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/event-organiser/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Stephen Harris](https://wordpress.org/support/users/stephenh1988/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/queries/#post-3178000)
 * Status: not resolved