Categories allow website owners to sort their content while making it easier for their users to browse the site. At WPBeginner we use different categories to sort content on our site. For example, when a user arrives on our site, they can go directly to the beginners guide section or WordPress tutorials. Doing so they will be able to skip posts in our other categories. Sometimes you may want your users to be able to search inside a specific category rather than the entire site. In the past, we wrote an article about how to create an advanced search form for custom post types, and a lot of you asked if there was a way to do the same thing for categories. In this article we will show you how to add search by category functionality in your WordPress site. The goal is to add a search box that allows visitors to search inside specific categories.
First thing you need to do is install and activate the Category Wise Search plugin. Upon activation, you need to visit Appearance » Widgets page. There you will notice a new Category Wise Search widget in the list of available widgets. Simply drag and drop the widget to your sidebar and configure the widget options.
The widget’s settings allow you to exclude categories from the search box. Leaving exclude categories box empty will will show all your categories in the drop down menu. When you are done simply click on the save button to store your widget settings.
You can now visit your website to see the search by category feature in action.
Category Wise Search plugin allows you to exclude categories from your search results, but you can also exclude pages from WordPress search results. Remember that this search by category plugin will only be helpful if you are using categories and tags the right way. We hope this article help you improve your site search by adding search by category feature in WordPress. We are curious to know how many of you still use default WordPress search box on your websites? How many of you are using something advanced like custom post type search, search by category, google custom search, Amazon CloudSearch with Lift, etc? Let us know in your comments below.
Hey help , I want to create a search box for web page and it should search in only one page category. How can i do that in wordpress.
This is exactly what I was looking for! Needed a sidebar for a separate review section, with a search bar that only searched that separate section. So this was perfect
Thanks for the support for this awesome plugin. i have tried the plugin, the search by name works fine but the category search is not showing any result. i guess it is not compatible with 3.5 — >3.8.
i have tried changing “cat” to “category” but all to no avail . Any quick help will be hugely appreciated. Thanks in advance.
After I installed this plugin, the original categories widget doesn’t work any more!
Once I removed the plugin, it’s work again!
I still can’t find the reason.
Could someone tell me how to fix the problem?
Thanks a lot!
i run both regular search with google custom search, and the search category plugin, . i modified the searchform.php in order to have google search results ( with this shortcode ).
When i use the search by category plugin the results are the same of the standard so they are not filtered obviously because i use in both case google custom search .
so i would reset thestandard only for () for this plugin
how can i Do?
thanks
you can not use search by category and Google custom search. You can create two different forms and search templates.
Team,
I tried the steps above, but when i added [sbc] in the text area, it just displayed that as a text instead of calling the search box. Am i missing something here.
Else, also not sure where i can add the mentioned code in the theme template. Could someone help me with the specific theme file i need to edit.
Thanks
Please post all plugin related support in the supports forum:
http://wordpress.org/support/plugin/search-by-category
Oh I’m so glad to find this plugin! I think I need to keep looking though because I need to have it search specific pages on my site as well as some categories of posts.
Really saved my time a lot ………..
This plugin still works with wordpress 3.5.1 !!!!
@Alian there is a plugin for that, Query multiple taxonomies.
You can find it @ http://scribu.net/wordpress/query-multiple-taxonomies/ . I use it and it`s working like a charm.
Can this be used for search results?
Search by category is only tested for WordPress version up to 3.4.2 – is it ok to install anyway? I use 3.5.0
I really look forward to a functionality which will make it easier for my readers to browse and seach in my categories.
Greetings Gitte
Yes it is fine. It will work.
I just did a review of different options for a client site and eventually installed the Search Everything plugin. It gives you the option to also configure what gets searched. And in this case I wanted to exclude a couple of categories.
If no serious customization is needed, you could just use the following snippet in your searchform.php
<form method="get" id="searchform" action="<?php echo home_url(); ?>">
<input type="search" id="s" name="s" />
<?php wp_dropdown_categories( 'show_option_all=All Categories' ); ?>
</form>
What would this do for you? tried it but nothing.
I use Relevanssi on one of my sites and it is great but I would love to add something like this to narrow search fields but rather than narrow by category. I’d like to narrow by custom taxonomy.