{"id":96485,"date":"2014-01-24T09:58:15","date_gmt":"2014-01-24T17:58:15","guid":{"rendered":"https:\/\/tri.be\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/"},"modified":"2014-04-17T06:04:35","modified_gmt":"2014-04-17T13:04:35","slug":"tribe_get_events-start-and-end-date-problem","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/","title":{"rendered":"tribe_get_events start and end date problem"},"content":{"rendered":"<p>&lt;p&gt;I saw a thread similar to this that had been closed, but nothing in the thread seemed directly relevant. I am running a custom query in the header.php file of our theme to pull the current days&#8217; &#8220;open&#8221; vs. &#8220;closed&#8221; hours, so it can echo those values in a little wooden sign we have in the left sidebar. This works fine on all pages EXCEPT for the page we are actually using to show the calendar (\/events). For whatever reason &#8211; and I&#8217;ve analyzed the query results with no end of var_dumps and such &#8211; the same exact query that works on every other page when the header loads returns multiple events instead of just the one in question for that date. I have spent hours trying to figure this out and am tearing out my hair. Here is the basic query. Start and end date are calculated and passed in as $current_date and $end_date.&lt;\/p&gt;<\/p>\n<pre>\n$sf_events = tribe_get_events(\n            array(\n                'start_date' =&gt; $current_date,\n                'end_date' =&gt; $end_date,\n                'tax_query' =&gt; array(\n                    array(\n                        'taxonomy' =&gt; 'tribe_events_cat',\n                        'field' =&gt; 'slug',\n                        'terms' =&gt; 'splashin-safari-hours'\n                    )\n                )\n            )\n    );\n<\/pre>\n<p>&lt;p&gt;To make sure something odd wasn&#8217;t happening with my $current_date and $end_date variables themselves, I dumped the values from several points in the template to make sure they hadn&#8217;t changed. They don&#8217;t &#8211; they remain as expected, both on the pages where it works right and on the page where it works wrong. It simply ignores the date criteria on the \/events page ONLY. I have tried querying directly with WP_Query, but couldn&#8217;t get that to filter correctly for the dates. I even tried calling TribeEventsQuery::getEvents() as a static function instead of using tribe_get_events to see if your wrapper function was doing anything weird. No dice. Again, the query works correctly on all other pages. Any ideas? I&#8217;m imagining it must have something to do with the fact that the \/events page is generated by one of your templates, but I can&#8217;t seem to figure out what the difference is.&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-96485","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>tribe_get_events start and end date problem -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"tribe_get_events start and end date problem -\" \/>\n<meta property=\"og:description\" content=\"&lt;p&gt;I saw a thread similar to this that had been closed, but nothing in the thread seemed directly relevant. I am running a custom query in the header.php file of our theme to pull the current days&#8217; &#8220;open&#8221; vs. &#8220;closed&#8221; hours, so it can echo those values in a little wooden sign we have in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/\" \/>\n<meta property=\"article:modified_time\" content=\"2014-04-17T13:04:35+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/\",\"name\":\"tribe_get_events start and end date problem -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2014-01-24T17:58:15+00:00\",\"dateModified\":\"2014-04-17T13:04:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"tribe_get_events start and end date problem\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"tribe_get_events start and end date problem -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/","og_locale":"en_US","og_type":"article","og_title":"tribe_get_events start and end date problem -","og_description":"&lt;p&gt;I saw a thread similar to this that had been closed, but nothing in the thread seemed directly relevant. I am running a custom query in the header.php file of our theme to pull the current days&#8217; &#8220;open&#8221; vs. &#8220;closed&#8221; hours, so it can echo those values in a little wooden sign we have in [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/","article_modified_time":"2014-04-17T13:04:35+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/","name":"tribe_get_events start and end date problem -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2014-01-24T17:58:15+00:00","dateModified":"2014-04-17T13:04:35+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_get_events-start-and-end-date-problem\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"tribe_get_events start and end date problem"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/96485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/96485\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=96485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}