{"id":985503,"date":"2015-07-10T13:28:30","date_gmt":"2015-07-10T20:28:30","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/"},"modified":"2015-07-25T07:05:04","modified_gmt":"2015-07-25T14:05:04","slug":"excluding-single-category-from-upcoming-view-removes-category-from-my-events","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/","title":{"rendered":"Excluding single category from upcoming view removes category from &quot;my events&quot;"},"content":{"rendered":"<p>Hello.<\/p>\n<p>I am trying to exclude a single category from our upcoming\/month view pages. Here is the code I have in my theme&#8217;s functions.php file, as per other forum topics:<\/p>\n<pre><code>add_action( &#039;pre_get_posts&#039;, &#039;exclude_events_category&#039; );\nfunction exclude_events_category( $query ) {\n\n  if ( $query-&gt;query_vars[&#039;eventDisplay&#039;] == &#039;upcoming&#039; || $query-&gt;query_vars[&#039;eventDisplay&#039;] == &#039;past&#039; || $query-&gt;query_vars[&#039;post_type&#039;] == TribeEvents::POSTTYPE &amp;&amp; !is_tax(TribeEvents::TAXONOMY) &amp;&amp; empty( $query-&gt;query_vars[&#039;suppress_filters&#039;] ) ) {\n    $query-&gt;set( &#039;tax_query&#039;, array(\n      array(\n        &#039;taxonomy&#039; =&gt; TribeEvents::TAXONOMY,\n        &#039;field&#039; =&gt; &#039;slug&#039;,\n        &#039;terms&#039; =&gt; array(&#039;yard-sales&#039;),\n        &#039;operator&#039; =&gt; &#039;NOT IN&#039;\n      )\n    ) );\n  }\n\n  return $query;\n} <\/code><\/pre>\n<p>However, this also removes &#8216;yard-sales&#8217; category events from the front-end user&#8217;s &#8220;My Events&#8221; page.  Since we are only using the Community Events add-on to allow people to post yard sales, which we&#8217;re trying to display separately from our main events calendar, this is an issue. <\/p>\n<p>Is it possible to exclude the category from the main upcoming events page AND display it on the front-end user&#8217;s &#8220;My Events&#8221; page?<\/p>\n<p>Thanks for your help.<\/p>\n","protected":false},"template":"","class_list":["post-985503","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>Excluding single category from upcoming view removes category from &quot;my events&quot; -<\/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\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Excluding single category from upcoming view removes category from &quot;my events&quot; -\" \/>\n<meta property=\"og:description\" content=\"Hello. I am trying to exclude a single category from our upcoming\/month view pages. Here is the code I have in my theme&#8217;s functions.php file, as per other forum topics: add_action( &#039;pre_get_posts&#039;, &#039;exclude_events_category&#039; ); function exclude_events_category( $query ) { if ( $query-&gt;query_vars[&#039;eventDisplay&#039;] == &#039;upcoming&#039; || $query-&gt;query_vars[&#039;eventDisplay&#039;] == &#039;past&#039; || $query-&gt;query_vars[&#039;post_type&#039;] == TribeEvents::POSTTYPE &amp;&amp; !is_tax(TribeEvents::TAXONOMY) &amp;&amp; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-07-25T14:05: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\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/\",\"name\":\"Excluding single category from upcoming view removes category from &quot;my events&quot; -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-07-10T20:28:30+00:00\",\"dateModified\":\"2015-07-25T14:05:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-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\":\"Community Events\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Excluding single category from upcoming view removes category from &quot;my events&quot;\"}]},{\"@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":"Excluding single category from upcoming view removes category from &quot;my events&quot; -","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\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/","og_locale":"en_US","og_type":"article","og_title":"Excluding single category from upcoming view removes category from &quot;my events&quot; -","og_description":"Hello. I am trying to exclude a single category from our upcoming\/month view pages. Here is the code I have in my theme&#8217;s functions.php file, as per other forum topics: add_action( &#039;pre_get_posts&#039;, &#039;exclude_events_category&#039; ); function exclude_events_category( $query ) { if ( $query-&gt;query_vars[&#039;eventDisplay&#039;] == &#039;upcoming&#039; || $query-&gt;query_vars[&#039;eventDisplay&#039;] == &#039;past&#039; || $query-&gt;query_vars[&#039;post_type&#039;] == TribeEvents::POSTTYPE &amp;&amp; !is_tax(TribeEvents::TAXONOMY) &amp;&amp; [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/","article_modified_time":"2015-07-25T14:05: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\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/","name":"Excluding single category from upcoming view removes category from &quot;my events&quot; -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-07-10T20:28:30+00:00","dateModified":"2015-07-25T14:05:04+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-events\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/excluding-single-category-from-upcoming-view-removes-category-from-my-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":"Community Events","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/"},{"@type":"ListItem","position":5,"name":"Excluding single category from upcoming view removes category from &quot;my events&quot;"}]},{"@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\/985503","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\/985503\/revisions"}],"predecessor-version":[{"id":985584,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/985503\/revisions\/985584"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=985503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}