DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Categories

How to Search by Category in WordPress (Three Practical Ways)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WordPress does not add a category picker to its standard search box. To find or display posts by category, use the category archive, a category-filtered Query Loop, or a custom query in code. If you need category and text matching together, apply a taxonomy filter and a separate keyword filter.

Choose the method that matches your goal

What you want Best method What visitors see
Show every post assigned to one category Category archive A WordPress archive page for that category
Place a category-limited list inside a page or template Query Loop block A list or grid embedded in your chosen layout
Let visitors filter interactively, or apply custom logic Plugin or developer code Filter controls or a programmed result set

The normal WordPress search field searches text. It does not, by itself, expose a category selector.

Use a category archive

Every category has an archive that displays posts assigned to it. In the dashboard, open Posts > Categories, locate the category, and use its View link to open the public archive. You can also link to that archive from a menu, page, or post.

This is the simplest option when visitors only need “all posts in this category.” The archive’s appearance and pagination come from your theme’s archive template. It is not a search form and does not combine a category restriction with a keyword entered by the visitor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build a category-filtered list with Query Loop

The block editor’s Query Loop block can display posts according to specified parameters without PHP. Use it when a category list must appear inside a particular page, landing page, or template.

1. Insert the block

  1. Edit the page or template where the results should appear.
  2. Insert a Query Loop block and choose a pattern, or start with a blank loop.

2. Switch to a custom query

Select the Query Loop itself and open its settings. Query Type normally starts at Default, which lets the surrounding template determine the posts. Change it to Custom to expose the list and filter controls. If you cannot see taxonomy settings, confirm that the Query Loop—not a nested Post Template block—is selected.

3. Add the category filter

  1. In the Query Loop settings, open Filters.
  2. Add Taxonomies.
  3. Choose the category to include, or configure the control to exclude selected categories.

The taxonomies and choices available in the editor can vary with the post type, theme, and installed plugins. For standard blog posts, the control normally lists your post categories.

Rank #2
WordPress 2.7 Cookbook
  • Used Book in Good Condition

4. Add keyword matching when needed

Category filtering and text matching are separate controls. Add a Keyword filter if the results must also match entered terms. WordPress’ documented behavior requires every keyword entered in that filter to match; it is not an “any of these words” option.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Design the repeated result

The Query Loop contains nested blocks. The Post Template controls the repeated card or row; add Post Title, Featured Image, Excerpt, Date, or other blocks and choose a list or grid layout. Add Pagination for multi-page results and a No Results block with a useful message so an empty match does not leave a blank section.

6. Preview the published page

Preview the page while logged out or in a private window and check the category, post type, layout, pagination, and empty-state message. The editor exposes the available controls, but theme and plugin combinations can change what is shown.

Combine a category with the site search

If visitors must type a phrase and limit it to one category, a single native search box is not enough. A Query Loop can provide a fixed category restriction plus a keyword control on a designed page. For a visitor-facing form that changes categories without editing the page, use a taxonomy-filter plugin or build a custom form and query.

Use a custom WP_Query loop

Developers can create a separate query and render its posts wherever needed. This example limits standard posts to the news category and restores the original post context afterward:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<?php
$category_posts = new WP_Query([
    'post_type'      => 'post',
    'category_name'  => 'news',
    'posts_per_page' => 10,
]);

if ( $category_posts->have_posts() ) {
    while ( $category_posts->have_posts() ) {
        $category_posts->the_post();
        echo '<article>';
        the_title( '<h3>', '</h3>' );
        the_excerpt();
        echo '</article>';
    }
}

wp_reset_postdata();
?>

Replace news with the category slug. Use additional query arguments when you need ordering, pagination, a different post type, or taxonomy combinations. Always call wp_reset_postdata() after a secondary loop so template tags return to the original post.

Change the main category archive query

Use pre_get_posts when you need to alter the archive’s existing main query, rather than creating a second loop. Target the front-end main query and the intended category condition so sidebars, footers, and other custom loops are not changed accidentally.

<?php
function freedom251_adjust_news_archive( $query ) {
    if ( is_admin() || ! $query->is_main_query() || ! $query->is_category( 'news' ) ) {
        return;
    }

    $query->set( 'posts_per_page', 15 );
}
add_action( 'pre_get_posts', 'freedom251_adjust_news_archive' );
?>

Use WP_Query for a separate list and pre_get_posts for the main archive query. Avoid making query_posts() your default approach; it can interfere with the main query and pagination.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Add interactive taxonomy filters with a plugin

Plugins are useful when visitors need controls such as category links or a select menu instead of a page fixed to one category. Check the current plugin listing, theme, and WordPress compatibility before installing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Category Filter Block

The WordPress.org listing describes a block that filters a standard Query Loop by category, can render links or a select dropdown, and can update results without a page refresh. Its Pro tier adds custom-taxonomy and multiple-taxonomy features according to the listing.

Taxonomy Query Filter

This listing describes a block placed inside a Query Loop that supports categories, tags, and registered custom taxonomies. It states that filtered results retain Query Loop pagination, that reload versus AJAX behavior follows the Query Loop setting, and that one filter per Query Loop is currently supported.

Compare before choosing

  • Taxonomy coverage: categories only or custom taxonomies too.
  • Whether multiple filters can be combined.
  • Visitor controls: links, dropdowns, or another documented interface.
  • Full-page reload versus AJAX behavior.
  • Pagination and compatibility with your theme and block editor.
  • Whether the required feature is free or requires a Pro plan.

These are publisher-described features, not independent performance tests; verify current terms and compatibility on the listing before deployment.

Troubleshoot category results

  • Filters are missing: select the outer Query Loop and change Query Type from Default to Custom.
  • The wrong posts appear: confirm that the category is assigned to the intended post type and that the filter is set to include rather than exclude.
  • Keyword searches are too narrow: multiple entered keywords must all match; remove unnecessary terms or provide separate controls.
  • An empty area appears: add and configure a No Results block.
  • Pagination behaves oddly in code: use the main query for an archive adjustment, or supply the correct pagination arguments in a custom WP_Query and reset post data.
  • Other page sections change unexpectedly: tighten a pre_get_posts condition with is_admin(), is_main_query(), and the relevant archive check.

The Bottom Line

Use a category archive for a straightforward category page, Query Loop for a no-code list embedded in a chosen layout, and WP_Query or pre_get_posts when you need custom behavior. Add a plugin only when visitors require interactive taxonomy controls beyond the built-in editor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.