To hide child categories from a WordPress list, first identify the element that renders it. In the Categories List block, enable Show only top-level categories. A classic Categories widget does not document an equivalent top-level-only option, while the Categories block used in a Query Loop serves a different purpose. Styling controls also vary by element and theme.
Identify the category element you are editing
WordPress can display categories through several different blocks and widgets. The correct setting depends on which one is selected in the editor.
| Element | Typical location | Can it hide child categories? | Relevant controls |
|---|---|---|---|
| Categories List block | Page, post, template, sidebar, header or footer | Yes. Enable Show only top-level categories. | Top-level-only display, hierarchy, empty categories, color, typography, dimensions, borders and additional CSS classes. |
| Categories block | Usually inside a Query Loop | Its documented purpose is to show categories attached to each post; a top-level-only setting is not documented. | Default or pill style, color, typography, dimensions, borders and advanced options. |
| Classic Categories widget | Widget areas in classic themes | No top-level-only option is listed in the cited documentation. | Dropdown display, post counts and Show hierarchy. |
Hide subcategories with the Categories List block
This is the clearest built-in method when you want a site-wide or template-level list to show parent categories without their children.
- Open the page, post, template or template part containing the list.
- Select the Categories List block.
- Open the block’s settings sidebar.
- Turn on Show only top-level categories.
- Preview the list at the screen sizes where it appears and save the change.
The block has separate settings for showing hierarchy and empty categories. Turning off hierarchy changes how relationships are indicated; it does not remove child categories. The top-level-only setting is the one that excludes children from this display.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
What “Show hierarchy” actually does
Show hierarchy controls visual indication of parent-child relationships, commonly through indentation or nested presentation. It is not a filter.
- Use Show only top-level categories when child links should not appear.
- Use Show hierarchy when child links should remain visible and readers should see their relationship to parents.
- Do not assume a flat-looking list contains only parents; a flat presentation can still include every category.
Classic Categories widget: available choices and limitation
In a classic theme, open the widget area that contains the Categories widget and review its settings. The documented options include a dropdown, post counts and Show hierarchy. Hierarchy can indent child categories, but the documentation does not list a setting that displays only top-level categories.
If the widget must show parents only, replace it with a Categories List block where the theme permits blocks, use a menu built from selected parent categories, or use a plugin or custom development that explicitly supports filtering. Do not treat the widget’s hierarchy checkbox as a child-category filter.
Categories block inside a Query Loop
The Categories block is primarily used in a Query Loop to display the categories assigned to each post card. It is not the same as a site-wide category directory.
- Select the Query Loop in the editor.
- Select the Categories block inside the repeated post layout.
- Choose its default or pill-shaped style.
- Adjust the available color, typography, dimensions and border settings.
- Preview several posts, because each post may have a different number of category links.
Available design controls can vary with the active theme. The documented settings do not establish a universal control for showing only parent categories in this context.
Style a Categories List block without breaking the theme
Use built-in design controls first
Select the Categories List block and use its color, typography, dimensions and border panels. These controls are less fragile than theme-dependent CSS and generally follow the site’s design system.
Rank #3
Add a scoped class for custom CSS
For custom styling, add a value such as category-directory in the block’s Advanced panel under Additional CSS class(es). Then inspect the rendered HTML in your browser’s developer tools and write CSS scoped to that class.
There is no selector guaranteed to identify subcategory links across every WordPress version, theme, widget and plugin. Markup can differ, so inspect the actual list before targeting nested elements. A safe workflow is:
- Add the class to the specific Categories List block.
- Open the published page and inspect the list and its links.
- Identify the classes or nesting used by that installation.
- Write selectors beginning with your custom class so other category lists are unaffected.
- Test hover, keyboard focus, mobile layout and dark or high-contrast styles before publishing.
Use the same principle for a Categories block in a Query Loop: select its built-in style first, then scope any custom rules to a class on that block or its containing layout.
Rank #4
Block themes versus classic themes
Block themes use blocks for areas such as headers, content and footers and let you edit templates in the Site Editor. The Customizer is not available in a block theme unless a theme or plugin reactivates it.
- Block theme: go to Appearance → Editor, open the relevant template or template part, and select the category block there.
- Classic theme: check Appearance → Widgets for a Categories widget, or edit a page or post containing a block.
If a familiar widget or Customizer control is missing, the theme type is often the reason. Edit the actual block or template that renders the list rather than changing an unrelated sidebar setting.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Hiding a link does not change category hierarchy
Displaying only parent categories is a presentation change. It does not delete child categories, detach posts, or alter archive relationships.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
WordPress category archives follow the hierarchy: a child-category archive shows posts assigned to that child, while a parent-category archive includes posts assigned to the parent and its subcategories. A post assigned to a child does not also need an explicit parent assignment to appear in the parent’s archive.
Therefore, you can hide child links in a navigation list while keeping their archives and relationships intact. To change those relationships, edit the category’s parent assignment or the post’s category assignments separately.
Quick Recap
Troubleshoot a list that still shows subcategories
- Wrong element selected: confirm that you edited Categories List, not a Categories block inside a Query Loop or a classic widget.
- Hierarchy was only switched off: enable Show only top-level categories; disabling hierarchy merely removes visual nesting.
- Another list is visible: inspect the header, footer, sidebar and template parts for a second category element.
- Theme or plugin output: custom navigation, widgets and plugins may render their own markup and settings.
- Cached page: clear the site’s page cache and your browser cache after saving, then verify the published URL.
- Custom CSS has no effect: check the block’s additional class, selector specificity and the actual rendered markup.
Choose the right approach
| Your goal | Recommended approach |
|---|---|
| Show parent categories only in a block-based list | Categories List block → Show only top-level categories. |
| Keep children but make nesting obvious | Keep all categories and enable Show hierarchy. |
| Change colors, spacing or typography | Use the selected block’s design panels, then add a scoped class for custom CSS. |
| Style categories attached to each post card | Configure the Categories block inside the Query Loop. |
| Control a classic widget | Use its dropdown, post-count and hierarchy settings; replace it if parent-only output is required. |
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

