{"id":970860,"date":"2015-06-18T02:44:38","date_gmt":"2015-06-18T09:44:38","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/"},"modified":"2015-07-08T07:00:04","modified_gmt":"2015-07-08T14:00:04","slug":"querying-in-custom-filter-bar-filters","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/","title":{"rendered":"Querying in custom Filter Bar filters"},"content":{"rendered":"<p>I&#8217;m trying to set up some custom filters for Filter Bar. I need to do some things that don&#8217;t involve the simple system provided.<\/p>\n<p>I&#8217;ve set up a basic custom filter easy enough following the advice here: https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-filter-to-filter-bar-2\/  As long as you have a taxonomy or custom field you want to filter against, just populate the values for a drop-down, all works great.<\/p>\n<p>However, I&#8217;m trying to replace the &#8216;Cost&#8217; filter with one that is simply a checkbox to filter and only show events that are free. I know this is possible with the &#8216;Cost&#8217; filter, but we need the interface to be simpler, we don&#8217;t want comprehensive cost filtering, just &#8220;free?&#8221;, or show everything. And we need some other, more complex filters. I thought it would be good to start with the problems with this one, it may help on the way to the more complex ones.<\/p>\n<p>The code I&#8217;ve got so far is here: https:\/\/gist.github.com\/gyrus\/af981f6e3ab19a940b59<\/p>\n<p>Using Query Monitor the query being performed is this: http:\/\/pastebin.com\/iETYQNep<\/p>\n<p>The join for the event cost meta field seems to give the alias <code>mt1<\/code> to the meta table, but the OR condition seems to be using both this and the plain meta table name. Is this part of the issue? I wonder if this is something to do with the filter bar setup_query_args() setting args rather than concatenating them?<\/p>\n<p>Further, does this lead to issues with applying multiple custom filters at once?<\/p>\n<p>Anyway, it&#8217;d be good to get this simple one working first!<\/p>\n","protected":false},"template":"","class_list":["post-970860","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>Querying in custom Filter Bar filters -<\/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\/querying-in-custom-filter-bar-filters\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Querying in custom Filter Bar filters -\" \/>\n<meta property=\"og:description\" content=\"I&#8217;m trying to set up some custom filters for Filter Bar. I need to do some things that don&#8217;t involve the simple system provided. I&#8217;ve set up a basic custom filter easy enough following the advice here: https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-filter-to-filter-bar-2\/ As long as you have a taxonomy or custom field you want to filter against, just populate [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-07-08T14:00:04+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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/\",\"name\":\"Querying in custom Filter Bar filters -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-06-18T09:44:38+00:00\",\"dateModified\":\"2015-07-08T14:00:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/#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\":\"Querying in custom Filter Bar filters\"}]},{\"@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":"Querying in custom Filter Bar filters -","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\/querying-in-custom-filter-bar-filters\/","og_locale":"en_US","og_type":"article","og_title":"Querying in custom Filter Bar filters -","og_description":"I&#8217;m trying to set up some custom filters for Filter Bar. I need to do some things that don&#8217;t involve the simple system provided. I&#8217;ve set up a basic custom filter easy enough following the advice here: https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-filter-to-filter-bar-2\/ As long as you have a taxonomy or custom field you want to filter against, just populate [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/","article_modified_time":"2015-07-08T14:00:04+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/","name":"Querying in custom Filter Bar filters -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-06-18T09:44:38+00:00","dateModified":"2015-07-08T14:00:04+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/querying-in-custom-filter-bar-filters\/#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":"Querying in custom Filter Bar filters"}]},{"@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\/970860","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":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/970860\/revisions"}],"predecessor-version":[{"id":971071,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/970860\/revisions\/971071"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=970860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}