{"id":1347702,"date":"2017-09-11T13:24:06","date_gmt":"2017-09-11T20:24:06","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/"},"modified":"2017-09-11T13:24:06","modified_gmt":"2017-09-11T20:24:06","slug":"exclude-category-from-events-page-and-paginated-pages","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/","title":{"rendered":"Exclude category from events page and paginated pages"},"content":{"rendered":"<p>Hello!<\/p>\n<p>We are using the following code in our functions.php file to exclude the &#8220;ongoing&#8221; category from our events page. However, when the events page is paginated, that category is displaying on subsequent paginated pages (so when we click &#8220;page 2&#8221;, that category shows up in the event feed). Do you know if there is a way to resolve this? Any help is greatly appreciated!<\/p>\n<p>add_action( &#8216;pre_get_posts&#8217;, &#8216;tribe_exclude_events_category_month_list&#8217; );<br \/>\nfunction tribe_exclude_events_category_month_list( $query ) {<\/p>\n<p>    if ( isset( $query-&gt;query_vars[&#8216;eventDisplay&#8217;] ) &amp;&amp; ! is_singular( &#8216;tribe_events&#8217; ) ) {<\/p>\n<p>        if ( $query-&gt;query_vars[&#8216;eventDisplay&#8217;] == &#8216;photo&#8217; &amp;&amp; ! is_tax( Tribe__Events__Main::TAXONOMY ) || $query-&gt;query_vars[&#8216;eventDisplay&#8217;] == &#8216;month&#8217; &amp;&amp; $query-&gt;query_vars[&#8216;post_type&#8217;] == Tribe__Events__Main::POSTTYPE &amp;&amp; ! is_tax( Tribe__Events__Main::TAXONOMY ) &amp;&amp; empty( $query-&gt;query_vars[&#8216;suppress_filters&#8217;] ) ) {<\/p>\n<p>            $query-&gt;set( &#8216;tax_query&#8217;, array(<\/p>\n<p>                array(<br \/>\n                    &#8216;taxonomy&#8217; =&gt; Tribe__Events__Main::TAXONOMY,<br \/>\n                    &#8216;field&#8217;    =&gt; &#8216;slug&#8217;,<br \/>\n                    &#8216;terms&#8217;    =&gt; array( &#8216;Ongoing&#8217; ),<br \/>\n                    &#8216;operator&#8217; =&gt; &#8216;NOT IN&#8217;<br \/>\n                )<br \/>\n            ) );<br \/>\n        }<\/p>\n<p>    }<\/p>\n<p>    return $query;<br \/>\n}<\/p>\n","protected":false},"template":"","class_list":["post-1347702","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 from events page and paginated pages -<\/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-from-events-page-and-paginated-pages\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exclude category from events page and paginated pages -\" \/>\n<meta property=\"og:description\" content=\"Hello! We are using the following code in our functions.php file to exclude the &#8220;ongoing&#8221; category from our events page. However, when the events page is paginated, that category is displaying on subsequent paginated pages (so when we click &#8220;page 2&#8221;, that category shows up in the event feed). Do you know if there is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/\" \/>\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-from-events-page-and-paginated-pages\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/\",\"name\":\"Exclude category from events page and paginated pages -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-09-11T20:24:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/#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\":\"Exclude category from events page and paginated pages\"}]},{\"@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 from events page and paginated pages -","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-from-events-page-and-paginated-pages\/","og_locale":"en_US","og_type":"article","og_title":"Exclude category from events page and paginated pages -","og_description":"Hello! We are using the following code in our functions.php file to exclude the &#8220;ongoing&#8221; category from our events page. However, when the events page is paginated, that category is displaying on subsequent paginated pages (so when we click &#8220;page 2&#8221;, that category shows up in the event feed). Do you know if there is [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/","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-from-events-page-and-paginated-pages\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/","name":"Exclude category from events page and paginated pages -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-09-11T20:24:06+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/exclude-category-from-events-page-and-paginated-pages\/#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":"Exclude category from events page and paginated pages"}]},{"@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\/1347702","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\/1347702\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1347702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}