{"id":141697,"date":"2023-03-22T11:33:30","date_gmt":"2023-03-22T16:33:30","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=resource&#038;p=141697"},"modified":"2023-03-29T17:04:05","modified_gmt":"2023-03-29T22:04:05","slug":"how-to-exclude-a-category-from-a-wordpress-page","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/","title":{"rendered":"How to Exclude a Category From a WordPress Page"},"content":{"rendered":"\n<p>Categories are the best way to quickly organize content on your WordPress website. Users can easily find exactly what they\u2019re looking for just by moving through the categories at the top of your page. That said, having too many categories can be overwhelming and even confusing for site users. <\/p>\n\n\n\n<p>That\u2019s why it\u2019s important to display only the most important categories on your homepage. <\/p>\n\n\n\n<p>You may have opted for a site design that only allows for a few categories, or maybe there\u2019s a category you want to use internally but not show publicly. <\/p>\n\n\n\n<p>There\u2019s no native way to exclude a category in WordPress, but in this tutorial, we\u2019ll walk through how to exclude a category in a few simple steps. Here&#8217;s what we&#8217;ll cover: <\/p>\n\n\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator aligncenter has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Why Exclude a Category? <\/h2>\n\n\n\n<p>If your site has been around for awhile, you probably have a lot of content to sift through. But even if your website is just getting started, categories can provide a helpful way to make sense of your content. <\/p>\n\n\n\n<p>You likely won\u2019t have room on your homepage to display all of your categories, so it\u2019s important to hide the ones you don\u2019t need. This greatly helps with user experience by making it faster for users to get where they need to go, as well as speeding up your site (because it\u2019s loading less content). <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Improved User Experience <\/h3>\n\n\n\n<p>The main function of categories is site navigation. If you have too many categories or redundant ones, visitors might have a hard time finding what they want, get frustrated, and leave. <\/p>\n\n\n\n<p>This is especially important for people using site readers. They could get stuck in a category they don\u2019t need or want and not be able to find the article they were looking for. <\/p>\n\n\n\n<p>Consolidating those categories takes the guesswork away from your site users and presents them with a clear path for finding the content they want. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Improved Page Experience <\/h3>\n\n\n\n<p>Not only will your site visitors thank you for the improved navigation, but they\u2019ll also enjoy improved site speed, as removing anything from a page makes it faster to load. <\/p>\n\n\n\n<p>If you have categories you only use internally, such as \u201cArchives,\u201d excluding them from your homepage will allow you to keep using category functionality without dragging down your site. <\/p>\n\n\n\n<p>Now that you know why you might want to exclude a category, let\u2019s look into how to do it. The process is quick and easy. <\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator aligncenter has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How to Exclude a WordPress Category <\/h2>\n\n\n\n<p>We\u2019ve gone through the why, let\u2019s dive into the how. There are a couple ways to exclude a category from displaying on your WordPress site, but as is often the case when adding needed functionality to your WordPress site, the easiest way is with a plugin. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Use a Plugin <\/h3>\n\n\n\n<p>There are a few plugins that are great for excluding a category but we recommend Ultimate Category Excluder. As the name implies, it is a quick and easy way to exclude categories from displaying on your WordPress site. <\/p>\n\n\n\n<p>Here\u2019s how to use it. <\/p>\n\n\n\n<p><strong>Step 1<\/strong>\u2013 In your WordPress Admin, go to the Plugin tab in the lefthand toolbar and select \u201cAdd New.\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2023\/03\/WP-exclude-category-step-1.png\" alt=\"&quot;add New&quot; in the Plugins tab of WordPress Admin\" class=\"wp-image-141698\" width=\"507\" height=\"109\"\/><\/figure>\n\n\n\n<p><strong>Step 2<\/strong>\u2013 Search for Ultimate Category Excluder in the Search tab in the upper right.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"174\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2023\/03\/WP-exclude-category-step-2.png\" alt=\"Add Plugin search page\" class=\"wp-image-141699\"\/><\/figure>\n\n\n\n<p><strong>Step 3<\/strong>\u2013 Select the \u201cInstall Now\u201d button and wait for the plugin to install. Then choose the \u201cActivate\u201d button.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"237\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2023\/03\/WP-exclude-category-step-3.png\" alt=\"Install now and Activate via WordPress Add Plugins\" class=\"wp-image-141700\"\/><\/figure>\n\n\n\n<p><strong>Step 4<\/strong>\u2013 Open the plugin and simply check off the categories you would like to exclude and from where. The plugin is very customizable, allowing you to choose between \u201cMain Page,\u201d \u201cFeeds,\u201d \u201cArchives,\u201d and \u201cSearch.\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"353\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2023\/03\/WP-exclude-category-step-4.png\" alt=\"Ultimate Category Excluder Options screen\" class=\"wp-image-141701\"\/><figcaption class=\"wp-element-caption\">Quality WordPress plugins such as Ultimate Category Excluder make it easy to exclude categories from your WordPress site.<\/figcaption><\/figure>\n\n\n\n<p>In addition to Ultimate Category Excluder, there are other well-designed plugins that can help you exclude categories from your WordPress site. Search for all of your options in the <a href=\"https:\/\/wordpress.org\/plugins\/\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress Plugin Repository<\/a>, just remember to do your due diligence and make sure the plugins you\u2019re evaluating have been recently updated\/include positive user reviews. <\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator aligncenter has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Use Code<\/h3>\n\n\n\n<p>If you don\u2019t want to download another plugin, you can exclude categories from your WordPress site using code. It only takes a few steps and even a WordPress beginner can do it. Step 1\u2013 First and foremost, you\u2019ll have to find the page ID for the category you want to exclude. To find this, click on the \u201cPosts\u201d tab in your Admin sidebar and choose \u201cCategories.\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"190\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2023\/03\/WP-exclude-category-step-1b.png\" alt=\"WP Admin &quot;Categories&quot; screen\" class=\"wp-image-141702\"\/><\/figure>\n\n\n\n<p>Then, simply hover over the category you want to exclude. The ID will display in the URL at the bottom after \u201ccategory&amp;tag_ID=\u201d. For example the ID for the \u201cEvents\u201d category would be 29.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"156\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2023\/03\/WP-exclude-category-step-2b.png\" alt=\"\" class=\"wp-image-141703\"\/><\/figure>\n\n\n\n<p><strong>Step 2<\/strong>\u2013 Now you can add the following code to your functions.php file in your theme. Put your category ID in (\u2018cat\u2019, \u2018-\u2019 ) section. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function exclude_category_home( $query ) {\nif ( $query-&gt;is_home ) {\n$query-&gt;set( 'cat', '-29' );\n}\nreturn $query;\n}\n \nadd_filter( 'pre_get_posts', 'exclude_category_home' );<\/code><\/pre>\n\n\n\n<p>If you want to exclude multiple categories, separate them with a comma like this, ( &#8216;cat&#8217;, &#8216;-29, -4, -2&#8217; ). <\/p>\n\n\n\n<p>If you decide to include a category again or exclude another, this can be changed at any time. <\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator aligncenter has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Excluding a category from a WordPress page can help increase user experience and site speed. If you find your site visitors struggling with site navigation, it can be a really easy way to help them get where they need to go, quickly. <\/p>\n\n\n\n<p>Whether you decide to download a plugin or update your theme code, both of these easy fixes will have your homepage looking cleaner in no time! <\/p>\n\n\n\n<p><strong><a href=\"https:\/\/wpengine.com\/plans\/\" target=\"_blank\" rel=\"noreferrer noopener\">Find out more<\/a> about industry-leading WordPress hosting, including award-winning 24\/7\/365 support at <a href=\"https:\/\/wpengine.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP Engine<\/a>.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Categories are the best way to quickly organize content on your WordPress website. Users can easily find exactly what they\u2019re looking for just by moving through the categories at the top of your page. That said, having too many categories can be overwhelming and even confusing for site users. That\u2019s why it\u2019s important to display<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":141,"featured_media":141705,"template":"","resource-topic":[1396,901],"resource-role":[895,1397,896],"resource-type":[916],"class_list":["post-141697","resource","type-resource","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Exclude a Category From a WordPress Page<\/title>\n<meta name=\"description\" content=\"There\u2019s no native way to exclude a category in WordPress, but in this tutorial, we\u2019ll walk through how to exclude a category in a few simple steps.\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Exclude a Category From a WordPress Page\" \/>\n<meta property=\"og:description\" content=\"There\u2019s no native way to exclude a category in WordPress, but in this tutorial, we\u2019ll walk through how to exclude a category in a few simple steps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-29T22:04:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2023\/03\/WP-exclude-category_1200x627.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"627\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2023\/03\/WP-exclude-category_1200x627.png\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/\",\"url\":\"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/\",\"name\":\"How to Exclude a Category From a WordPress Page\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2023-03-22T16:33:30+00:00\",\"dateModified\":\"2023-03-29T22:04:05+00:00\",\"description\":\"There\u2019s no native way to exclude a category in WordPress, but in this tutorial, we\u2019ll walk through how to exclude a category in a few simple steps.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Exclude a Category From a WordPress Page\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/3e48f5212e0f80a697a09d5022f41300\",\"name\":\"Emily Schiola\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7064d2da506b87462a054a01607c1c611e2ee522935de6871df6c847b1f17739?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7064d2da506b87462a054a01607c1c611e2ee522935de6871df6c847b1f17739?s=96&d=mm&r=g\",\"caption\":\"Emily Schiola\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Exclude a Category From a WordPress Page","description":"There\u2019s no native way to exclude a category in WordPress, but in this tutorial, we\u2019ll walk through how to exclude a category in a few simple steps.","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"How to Exclude a Category From a WordPress Page","og_description":"There\u2019s no native way to exclude a category in WordPress, but in this tutorial, we\u2019ll walk through how to exclude a category in a few simple steps.","og_url":"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","article_modified_time":"2023-03-29T22:04:05+00:00","og_image":[{"width":1200,"height":627,"url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2023\/03\/WP-exclude-category_1200x627.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2023\/03\/WP-exclude-category_1200x627.png","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/","url":"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/","name":"How to Exclude a Category From a WordPress Page","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2023-03-22T16:33:30+00:00","dateModified":"2023-03-29T22:04:05+00:00","description":"There\u2019s no native way to exclude a category in WordPress, but in this tutorial, we\u2019ll walk through how to exclude a category in a few simple steps.","breadcrumb":{"@id":"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/case-studies\/resources\/how-to-exclude-a-category-from-a-wordpress-page\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"How to Exclude a Category From a WordPress Page"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/3e48f5212e0f80a697a09d5022f41300","name":"Emily Schiola","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7064d2da506b87462a054a01607c1c611e2ee522935de6871df6c847b1f17739?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7064d2da506b87462a054a01607c1c611e2ee522935de6871df6c847b1f17739?s=96&d=mm&r=g","caption":"Emily Schiola"}}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2023\/03\/WP-exclude-category_343x245.png","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Agency, Designer, Developer","topic":"<strong>Topics:<\/strong> Design, WordPress","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/141697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/141"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media\/141705"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=141697"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=141697"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=141697"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=141697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}