Tutorials

How to exclude a category from a Query Loop block

The Query Loop block is used to output a list of posts on your site, but in some scenarios, you don’t want posts from all of your categories or tags to be shown in the results. In this tutorial, we’re going to take a look at how you can exclude those categories and/or tags from a Query Loop.

  1. Log in to your WordPress administration panel, click on “Posts” or “Pages” in the menu on the left, and click the post or page that you want to edit in the list.
  2. If you already have a Query Loop block added to your content, click on it in the editor. If you don’t, add one by clicking the “+” button in the top left, searching for “Query Loop”, and choosing one of the layouts it suggests. You need to have the Query Loop itself selected, rather than any of the blocks inside of it. If you struggle to find it, you can expand the Document Overview to the left of the editor by clicking the list icon in the top left, and then click on the Query Loop block in the list.
  3. When you have selected the Query Loop block, the block settings will be shown in the right sidebar. By default, the “Query type” setting will be set to “Default”, which means that the Query Loop will display a list of posts or custom post types based on the current template. Since we’re editing a post or page and not a template, having the “Query type” set to “Default” means that the Query Loop won’t output anything at all. WordPress will also show a warning in the sidebar, saying that the Query Loop can’t inherit the current template query. Instead, let’s click on the “Custom” option beneath “Query type”.
  4. Clicking it shows a list of settings for the Query Loop. By default, it shows the latest posts in chronological order, with an option for how many posts to show per page. The setting we’re looking for is still hidden, though. To show it, click the plus icon next to the “Filters” label in the sidebar, and then select “Taxonomies” in the pop-up.
  5. Doing that shows us options for all of the taxonomies registered for regular posts. By default, they are categories and tags. With the four settings, we can limit the results to posts in specific categories or tags, and exclude posts that are in specific categories or tags.
  6. To exclude posts from a specific category, click the field labeled “Exclude: Categories”. Start to type the name of the category you want to exclude, and click on it when it appears in the dropdown beneath the field. The Query Loop block in the editor preview will now be updated to exclude posts from that category.
  7. Click on the “Save” button in the top right to save your changes.

You can exclude categories from a Query Loop block in a template in the Site Editor the same way. Keep in mind that if “Query type” is set to “Default” in a template, the “Filters” settings won’t be available. Switching it to “Custom” makes them available, but it also means that the Query Loop will no longer follow the current page – a category archive would show the same posts as every other archive, for example.

Published November 2, 2026

Modified November 22, 2026