{"id":1965711,"date":"2025-06-27T08:17:17","date_gmt":"2025-06-27T12:17:17","guid":{"rendered":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/?p=1965711"},"modified":"2025-06-27T08:17:53","modified_gmt":"2025-06-27T12:17:53","slug":"how-to-exclude-certain-categories-from-being-displayed-in-community-events-submission","status":"publish","type":"post","link":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/how-to-exclude-certain-categories-from-being-displayed-in-community-events-submission\/","title":{"rendered":"How To Exclude Certain Categories from Being Displayed in Community Events Submission"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-overview\">Overview<\/h2>\n\n\n\n<p>If you\u2019re using Community Events and want to prevent users from selecting certain event categories when submitting events through the frontend submission form, you can use a custom code snippet to exclude specific category IDs from the category dropdown.<\/p>\n\n\n\n<p>This is helpful if you use categories internally or want to limit what contributors can assign to their events.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-steps-to-exclude-categories\">Steps to Exclude Categories<\/h2>\n\n\n\n<p>Add the following snippet to your site\u2019s theme <code>functions.php<\/code> file or use a plugin like <strong><a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Code Snippets<\/a> <\/strong>plugin:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter(\n    'tribe_dropdown_search_terms',\n    function( $data, $search, $page, $args, $source ) {\n\n        \/\/ Only apply this to event categories\n        if ( 'tribe_events_cat' !== $args&#91; 'taxonomy' ] ) {\n            return tribe( 'ajax.dropdown' )->search_terms( $search, $page, $args, $source );\n        }\n\n        $exclude_ids = '4'; \/\/ Replace with your category ID(s) to exclude\n\n        \/\/ If no exclude is set, create one\n        if ( ! isset( $args&#91; 'exclude' ] ) ) {\n            $args&#91;'exclude'] = $exclude_ids;\n        } else {\n            \/\/ Convert to array if needed\n            if ( ! is_array( $args&#91;'exclude'] ) ) {\n                $args&#91;'exclude'] = explode( ',', $args&#91;'exclude'] );\n            }\n\n            \/\/ Merge with existing excluded IDs\n            $args&#91;'exclude'] = array_merge( $args&#91;'exclude'], (array) $exclude_ids );\n        }\n\n        \/\/ Return modified dropdown\n        return tribe( 'ajax.dropdown' )->search_terms( $search, $page, $args, $source );\n    },\n    10,\n    5\n);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-notes\">Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace <code>4<\/code> in <code>$exclude_ids = '4';<\/code> with the ID of the category you want to hide. You can also pass multiple IDs separated by commas (e.g., <code>'4,12,15'<\/code>).<\/li>\n\n\n\n<li>This affects only the dropdown in the Community Events submission form. It does not affect the backend or public display of events.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-find-category-ids\">How to Find Category IDs<\/h3>\n\n\n\n<p>To find a category ID:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Go to WP Admin Dashboard \u2192<\/strong> <strong><strong>Events <strong>\u2192<\/strong> Event Categories<\/strong>.<\/strong><br><\/li>\n\n\n\n<li>Hover over a category name and look at the URL preview in your browser\u2019s status bar. The <code>tag_ID<\/code> in the URL is the category ID as shown below:<br><\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full has-custom-border\"><img loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"36\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/06\/2025-06-26_20-36.png\" alt=\"\" class=\"wp-image-1965712\" style=\"border-width:1px\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/06\/2025-06-26_20-36.png 537w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/06\/2025-06-26_20-36-300x20.png 300w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><\/figure><\/div>\n\n\n<p>By using this filter, you can have more control over what options are available to event submitters and keep internal or restricted categories hidden from view.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview If you\u2019re using Community Events and want to prevent users from selecting certain event categories when submitting events through the frontend submission form, you can use a custom code snippet to exclude specific category IDs from the category dropdown. This is helpful if you use categories internally or want to limit what contributors can&#8230;<\/p>\n","protected":false},"author":48,"featured_media":1955565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[24,59,79],"tags":[251,25],"stellar-product-taxonomy":[152],"class_list":["post-1965711","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-customizing-resources","category-snippets","tag-community-events","tag-customizations","stellar-product-taxonomy-community-events"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":59,"label":"PHP &amp; Functions"},{"value":79,"label":"Snippets"}],"post_tag":[{"value":251,"label":"Community Events"},{"value":25,"label":"Customizations"}],"stellar-product-taxonomy":[{"value":152,"label":"Community"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Paul Acido","author_link":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/author\/paulacido\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":110,"filter":"raw","term_order":"0","cat_ID":24,"category_count":110,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":59,"name":"PHP &amp; Functions","slug":"customizing-resources","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":101,"filter":"raw","term_order":"0","cat_ID":59,"category_count":101,"category_description":"","cat_name":"PHP &amp; Functions","category_nicename":"customizing-resources","category_parent":24},{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":136,"filter":"raw","term_order":"0","cat_ID":79,"category_count":136,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":[{"term_id":251,"name":"Community Events","slug":"community-events","term_group":0,"term_taxonomy_id":251,"taxonomy":"post_tag","description":"","parent":0,"count":6,"filter":"raw","term_order":"0"},{"term_id":25,"name":"Customizations","slug":"customizations","term_group":0,"term_taxonomy_id":25,"taxonomy":"post_tag","description":"","parent":0,"count":177,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1965711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/48"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1965711"}],"version-history":[{"count":3,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1965711\/revisions"}],"predecessor-version":[{"id":1965715,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1965711\/revisions\/1965715"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1965711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1965711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1965711"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1965711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}