Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've noticed that my WooCommerce products are not searched by the default WordPress search function. Any idea how to modify the function to ensure that products and product tabs are searched?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Just extend your search form with a hidden input: (notice the last input field)

<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
        <span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ) ?></span>
        <input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ) ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" />
    <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>" />
    <input type="hidden" value="product" name="post_type" id="post_type" />
share|improve this answer

I'm running several WooCommerce sites, and the WordPress search does include products along with posts/pages. Do you have a custom search.php file or any custom functions that would alter the products taxonomy to exclude it from search? WooCommerce also has a product widget that can be used as well.

share|improve this answer
I'll check out the search.php file. The theme is sentient by WooThemes. I know for a fact that it's not searching the products but is searching pages and posts as I've tested it extensively. I have another site that runs the theme Mystile (again by WooThemes) and I noticed that the product search bar only seems to search products, not pages or posts. – Jeremiah Prummer Apr 7 '13 at 15:00
This may be a bug withing WooCommerce then. If you contact woothemes, their support is amazing and they may be able to help you if it is a but with WC or their themes. – Zach Russell Apr 7 '13 at 15:15

You can usually specify the post type in WP_Query.

  • Woocommerce is product

  • Wordpress posts is post

share|improve this answer
Some example with explanation would be great. – Nilambar Jun 25 at 3:48
Given that the original poster did not post source code, I didn't feel the need to make an effort either. – Epirocks Jun 27 at 8:55
Down-voted for... – Epirocks Jun 30 at 22:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.