{"id":1115184,"date":"2016-05-16T17:20:44","date_gmt":"2016-05-17T00:20:44","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/"},"modified":"2016-05-17T08:11:11","modified_gmt":"2016-05-17T15:11:11","slug":"exclude-category-the-events-calendar-not-pro","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/","title":{"rendered":"Exclude Category &#8211; The Events Calendar (not pro)"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I&#8217;m attempting to exclude a category from the main calendar page (all views). I&#8217;ve found several variations of the answer given here: https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-one-category-from-upcoming-events-list\/#post-46807<\/p>\n<p>I&#8217;ve added these to my child themes functions.php file and it has no effect.<\/p>\n<p>Here is my code:<br \/>\n\/\/ from http:\/\/snippi.com\/s\/rd9pqcd<br \/>\nadd_action( &#8216;pre_get_posts&#8217;, &#8216;exclude_events_category&#8217; );<br \/>\nfunction exclude_events_category( $query ) {<br \/>\nif ( $query-&gt;query_vars[&#8216;post_type&#8217;] == TribeEvents::POSTTYPE &amp;&amp; $query-&gt;query_vars[&#8216;eventDisplay&#8217;] == &#8216;upcoming&#8217; || $query-&gt;query_vars[&#8216;eventDisplay&#8217;] == &#8216;past&#8217; &amp;&amp; !is_tax(TribeEvents::TAXONOMY) &amp;&amp; empty( $query-&gt;query_vars[&#8216;suppress_filters&#8217;] ) ) {<br \/>\n  $query-&gt;set( &#8216;tax_query&#8217;, array(<br \/>\n    array(<br \/>\n      &#8216;taxonomy&#8217; =&gt; TribeEvents::TAXONOMY,<br \/>\n      &#8216;field&#8217; =&gt; &#8216;slug&#8217;,<br \/>\n      &#8216;terms&#8217; =&gt; array(&#8216;replaced-with-slug-of-excluded-category&#8217;),<br \/>\n      &#8216;operator&#8217; =&gt; &#8216;NOT IN&#8217;<br \/>\n    )<br \/>\n    )<br \/>\n  );<br \/>\n}<br \/>\nreturn $query;<br \/>\n}<\/p>\n<p>I noticed these answers were from The Events Calendar PRO forum. Should this solution be working with the standard version?<br \/>\nIs there a different solution for the standard version to exclude categories?<\/p>\n<p>Thanks in advance.<\/p>\n","protected":false},"template":"","class_list":["post-1115184","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>Exclude Category - The Events Calendar (not pro) -<\/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\/exclude-category-the-events-calendar-not-pro\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exclude Category - The Events Calendar (not pro) -\" \/>\n<meta property=\"og:description\" content=\"Hi, I&#8217;m attempting to exclude a category from the main calendar page (all views). I&#8217;ve found several variations of the answer given here: https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-one-category-from-upcoming-events-list\/#post-46807 I&#8217;ve added these to my child themes functions.php file and it has no effect. Here is my code: \/\/ from http:\/\/snippi.com\/s\/rd9pqcd add_action( &#8216;pre_get_posts&#8217;, &#8216;exclude_events_category&#8217; ); function exclude_events_category( $query ) { if [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-05-17T15:11:11+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\/exclude-category-the-events-calendar-not-pro\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/\",\"name\":\"Exclude Category - The Events Calendar (not pro) -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-05-17T00:20:44+00:00\",\"dateModified\":\"2016-05-17T15:11:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/#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\":\"Welcome!\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Pre-Sales Questions\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Exclude Category &#8211; The Events Calendar (not pro)\"}]},{\"@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":"Exclude Category - The Events Calendar (not pro) -","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\/exclude-category-the-events-calendar-not-pro\/","og_locale":"en_US","og_type":"article","og_title":"Exclude Category - The Events Calendar (not pro) -","og_description":"Hi, I&#8217;m attempting to exclude a category from the main calendar page (all views). I&#8217;ve found several variations of the answer given here: https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-one-category-from-upcoming-events-list\/#post-46807 I&#8217;ve added these to my child themes functions.php file and it has no effect. Here is my code: \/\/ from http:\/\/snippi.com\/s\/rd9pqcd add_action( &#8216;pre_get_posts&#8217;, &#8216;exclude_events_category&#8217; ); function exclude_events_category( $query ) { if [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/","article_modified_time":"2016-05-17T15:11:11+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\/exclude-category-the-events-calendar-not-pro\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/","name":"Exclude Category - The Events Calendar (not pro) -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-05-17T00:20:44+00:00","dateModified":"2016-05-17T15:11:11+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-the-events-calendar-not-pro\/#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":"Welcome!","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/"},{"@type":"ListItem","position":4,"name":"Pre-Sales Questions","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/"},{"@type":"ListItem","position":5,"name":"Exclude Category &#8211; The Events Calendar (not pro)"}]},{"@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\/1115184","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\/1115184\/revisions"}],"predecessor-version":[{"id":1115356,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1115184\/revisions\/1115356"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1115184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}