{"id":1023308,"date":"2015-11-09T09:49:59","date_gmt":"2015-11-09T17:49:59","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/"},"modified":"2015-11-11T07:32:10","modified_gmt":"2015-11-11T15:32:10","slug":"hide-category-from-calendar-views-not-working","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/","title":{"rendered":"Hide category from calendar views not working"},"content":{"rendered":"<p>I wanted to report an issue I came across while perusing the following knowledgebase post: Hide category from calendar views https:\/\/theeventscalendar.com\/knowledgebase\/hide-category-from-calendar-views\/<\/p>\n<p>This code snippet does not appear to work on the latest version of the Event Calendar Pro plugin (v 3.12.6).<\/p>\n<p>Here is the modified code I have put into my functions.php file. The &#8216;convention-center&#8217;, &#8216;member-events&#8217;, &#8216;edward-jones-dome&#8217; event categories already exist on my site and have serval posts within them but are still showing up on the main &#8220;\/events\/&#8221; page.<\/p>\n<p>\/*<br \/>\n * Removes categories &#8220;convention-center&#8221;, &#8220;edward-jones-dome&#8221; and &#8220;member-events&#8221; from list and month views<br \/>\n *\/<br \/>\nfunction tribe_exclude_events_category( $wp_query ) {<\/p>\n<p>\t\/\/ Slugs for the categories you wish to hide<br \/>\n\t$exclude_cats = array(&#8216;convention-center&#8217;, &#8216;member-events&#8217;, &#8216;edward-jones-dome&#8217;);<\/p>\n<p>\t\/\/ Include all posts on admin views<br \/>\n\tif ( is_admin() ) return $wp_query;<\/p>\n<p>\t\/\/ Uncomment to allow admins to view all events<br \/>\n\tif ( current_user_can(&#8216;administrator&#8217;) ) return $wp_query;<\/p>\n<p>\t\/\/ Join with current tax query if set<br \/>\n\tif (is_array($wp_query-&gt;tax_query))<br \/>\n\t\t$tax_query = $wp_query-&gt;tax_query;<br \/>\n\telse<br \/>\n\t\t$tax_query = array();<\/p>\n<p>\t\/\/ Setup an exclude from the tribe_events_cat taxonomy<br \/>\n\t$tax_query[] = array(<br \/>\n\t\t&#8216;taxonomy&#8217;  =&gt; &#8216;tribe_events_cat&#8217;,<br \/>\n\t\t&#8216;field&#8217;     =&gt; &#8216;slug&#8217;,<br \/>\n\t\t&#8216;terms&#8217;     =&gt; $exclude_cats,<br \/>\n\t\t&#8216;operator&#8217;  =&gt; &#8216;NOT IN&#8217;<br \/>\n\t);<\/p>\n<p>\tif (<br \/>\n\t\ttribe_is_event_query()<br \/>\n\t\t&amp;&amp; !is_single() \/\/ Uncomment to allow directly viewing an individual event page<br \/>\n\t\t&amp;&amp; !is_tax() \/\/ Uncomment to allow directly viewing the category page<br \/>\n\t) {<br \/>\n\t\t$wp_query-&gt;set(&#8216;tax_query&#8217;, $tax_query);<br \/>\n\t}<\/p>\n<p>\treturn $wp_query;<\/p>\n<p>}<\/p>\n<p>add_action( &#8216;pre_get_posts&#8217;, &#8216;tribe_exclude_events_category&#8217;, 100, 1 );<\/p>\n<p>Can you please help me figure out how to get this working?<\/p>\n","protected":false},"template":"","class_list":["post-1023308","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>Hide category from calendar views not working -<\/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\/hide-category-from-calendar-views-not-working\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hide category from calendar views not working -\" \/>\n<meta property=\"og:description\" content=\"I wanted to report an issue I came across while perusing the following knowledgebase post: Hide category from calendar views https:\/\/theeventscalendar.com\/knowledgebase\/hide-category-from-calendar-views\/ This code snippet does not appear to work on the latest version of the Event Calendar Pro plugin (v 3.12.6). Here is the modified code I have put into my functions.php file. The &#8216;convention-center&#8217;, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-11-11T15:32:10+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\/hide-category-from-calendar-views-not-working\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/\",\"name\":\"Hide category from calendar views not working -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-11-09T17:49:59+00:00\",\"dateModified\":\"2015-11-11T15:32:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/#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\":\"Hide category from calendar views not working\"}]},{\"@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":"Hide category from calendar views not working -","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\/hide-category-from-calendar-views-not-working\/","og_locale":"en_US","og_type":"article","og_title":"Hide category from calendar views not working -","og_description":"I wanted to report an issue I came across while perusing the following knowledgebase post: Hide category from calendar views https:\/\/theeventscalendar.com\/knowledgebase\/hide-category-from-calendar-views\/ This code snippet does not appear to work on the latest version of the Event Calendar Pro plugin (v 3.12.6). Here is the modified code I have put into my functions.php file. The &#8216;convention-center&#8217;, [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/","article_modified_time":"2015-11-11T15:32:10+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\/hide-category-from-calendar-views-not-working\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/","name":"Hide category from calendar views not working -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-11-09T17:49:59+00:00","dateModified":"2015-11-11T15:32:10+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/hide-category-from-calendar-views-not-working\/#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":"Hide category from calendar views not working"}]},{"@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\/1023308","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\/1023308\/revisions"}],"predecessor-version":[{"id":1023525,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1023308\/revisions\/1023525"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1023308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}