{"id":1407002,"date":"2017-12-16T03:47:25","date_gmt":"2017-12-16T11:47:25","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/"},"modified":"2017-12-16T03:47:25","modified_gmt":"2017-12-16T11:47:25","slug":"filtering-shows-past-events","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/","title":{"rendered":"filtering shows past events"},"content":{"rendered":"<p>Hi,<\/p>\n<p>This is a continuation of this issue: https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-now-shows-past-events\/ For some reason your private responses aren&#8217;t shown to me, even though they&#8217;re in my thread and I&#8217;m logged in. Anyway, as you&#8217;ll see there:<\/p>\n<ol>\n<li>The issue is that when filtering is applied, past events are shown.<\/li>\n<li>I went through very extensive testing (plugin \/ theme conflicts, etc.).<\/li>\n<li>In the end, because the Filter Bar update had completely broken our customisations, we decided on a radical approach of ditching all our customisations (which were extensive and working fine until your latest update &#8211; it was decided we were spending too much time managing clashes between updates and customisations, though, and the customisations are the only part of the process we have control over). We&#8217;ve added very minimal customisations back in.<\/li>\n<\/ol>\n<p>We were hoping that the overhaul would lose the &#8216;past events&#8217; issue, and it seemed that way in testing. But launching the new code, we&#8217;ve encountered the same problem again.<\/p>\n<p>We&#8217;ve wasted a lot of time working with these problems with your plugin, so I&#8217;d appreciate prompt and thorough support here.<\/p>\n<p>It may be necessary for a follow-up post so I can supply you with what you need to replicate our site and replicate the issue. However, here&#8217;s some of my debugging \/ notes:<\/p>\n<p>Our custom theme has one function hooked to pre_get_posts, and the only thing it&#8217;s doing is this. We were assured that this would make sure past events are never shown, but obviously it&#8217;s not working:<\/p>\n<pre><code>if ( $query-&gt;get( &#039;tribe_is_past&#039; ) ) {\n\t$query-&gt;set( &#039;post__in&#039;, array( 0 ) );\n}<\/code><\/pre>\n<p>Getting into WP_Query, when I dump the request just before it&#8217;s run, using the posts_request hook, the SQL looks OK except &#8211; to my eye, and given the issue we&#8217;re looking at &#8211; that the meta_key for _EventEndDate is specified, but the meta key for _EventStartDate is NOT specified. Maybe your engineers could make something of that? If not let me know and we can progress with getting you replicating the issue to fix it.<\/p>\n<pre><code>SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.*,\n                                    MIN(wp_postmeta.meta_value) AS EventStartDate,\n                                    MIN(tribe_event_end_date.meta_value) AS EventEndDate\nFROM wp_posts\nINNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)\nLEFT JOIN wp_postmeta AS tribe_event_end_date ON (wp_posts.ID = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = &#039;_EventEndDate&#039;)\nWHERE 1=1\n  AND ((wp_postmeta.meta_key = &#039;_yh_venue_area&#039;\n        AND wp_postmeta.meta_value = &#039;38&#039;))\n  AND wp_posts.post_type = &#039;tribe_events&#039;\n  AND (wp_posts.post_status = &#039;publish&#039;\n       OR wp_posts.post_status = &#039;tribe-ea-success&#039;\n       OR wp_posts.post_status = &#039;tribe-ea-failed&#039;\n       OR wp_posts.post_status = &#039;tribe-ea-schedule&#039;\n       OR wp_posts.post_status = &#039;tribe-ea-pending&#039;\n       OR wp_posts.post_status = &#039;tribe-ea-draft&#039;\n       OR wp_posts.post_status = &#039;private&#039;)\n  AND (wp_postmeta.meta_value &gt;= &#039;2017-12-16 11:31:00&#039;\n       OR (wp_postmeta.meta_value &lt;= &#039;2017-12-16 11:31:00&#039;\n           AND tribe_event_end_date.meta_value &gt;= &#039;2017-12-16 11:31:00&#039;))\nGROUP BY wp_posts.ID\nORDER BY EventStartDate ASC,\n         wp_posts.post_date ASC\nLIMIT 0, 10<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-1407002","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>filtering shows past events -<\/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\/filtering-shows-past-events\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"filtering shows past events -\" \/>\n<meta property=\"og:description\" content=\"Hi, This is a continuation of this issue: https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-now-shows-past-events\/ For some reason your private responses aren&#8217;t shown to me, even though they&#8217;re in my thread and I&#8217;m logged in. Anyway, as you&#8217;ll see there: The issue is that when filtering is applied, past events are shown. I went through very extensive testing (plugin \/ theme [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/\" \/>\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=\"3 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\/filtering-shows-past-events\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/\",\"name\":\"filtering shows past events -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-12-16T11:47:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/#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\":\"Filter Bar\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/filter-bar\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"filtering shows past events\"}]},{\"@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":"filtering shows past events -","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\/filtering-shows-past-events\/","og_locale":"en_US","og_type":"article","og_title":"filtering shows past events -","og_description":"Hi, This is a continuation of this issue: https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-now-shows-past-events\/ For some reason your private responses aren&#8217;t shown to me, even though they&#8217;re in my thread and I&#8217;m logged in. Anyway, as you&#8217;ll see there: The issue is that when filtering is applied, past events are shown. I went through very extensive testing (plugin \/ theme [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/","name":"filtering shows past events -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-12-16T11:47:25+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filtering-shows-past-events\/#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":"Filter Bar","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/filter-bar\/"},{"@type":"ListItem","position":5,"name":"filtering shows past events"}]},{"@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\/1407002","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\/1407002\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1407002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}