Title: is_search problem
Last modified: August 22, 2016

---

# is_search problem

 *  Resolved [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/)
 * Hi Chouby,
 * I found some very old info about problems with the is_search function but I believe
   that the old problem was resolved in the later versions.
    However I am using 
   the current version and also woocommerce and I have a problem with the is_search
   function…
 * In the main language the is_search is working perfectly but with the other language
   it is not working. (English – /en/)
 * Another problem in the search results page, in the main language I have in the
   body class “archive” and also “tax-product_cat” when the search string includes
   specific product category and also specific product tag.
    In English I don’t 
   have those in the search results body class and I must have them as they are 
   used both in the CSS and in some php if’s.
 * I hope you may have an idea about the why the problems are caused and find a 
   cool fix for me or maybe even everyone else that might have such issue.
 * By the way, my search filter looks like this (its a dropdown populated with product
   tags shown in each category):
    Main language: [http://THE-DOMAIN-NAME/?s=&product_cat=THE-CATEGORY-THAT-WE-FILTERED-IN&product_tag=THE-SELECTED-TAG](http://THE-DOMAIN-NAME/?s=&product_cat=THE-CATEGORY-THAT-WE-FILTERED-IN&product_tag=THE-SELECTED-TAG)
 * English:
    [http://THE-DOMAIN-NAME/en/?s=&product_cat=THE-CATEGORY-THAT-WE-FILTERED-IN&product_tag=THE-SELECTED-TAG](http://THE-DOMAIN-NAME/en/?s=&product_cat=THE-CATEGORY-THAT-WE-FILTERED-IN&product_tag=THE-SELECTED-TAG)
 * As you can see it looks as if they are exactly the same and should show properly…
 * [https://wordpress.org/plugins/polylang/](https://wordpress.org/plugins/polylang/)

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791158)
 * Hi!
 * Not sure but from your explation, I understand that THE-CATEGORY-THAT-WE-FILTERED-
   IN and THE-SELECTED-TAG are a product cat and a product tag in the default language.
   So it is expected to get empty results when you query them in English.
 * You must tranlate these product cat and product tag. If you have some PHP knowledge,
   you can use the Polylang API function [pll_get_term](https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/#pll_get_term)
   to do this.
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791165)
 * Thank you for the so fast asnwer!
 * As a matter of fact, the product tag and category tags are not taken from the
   default language and the results are being shown.
 * The problem is that I modified woocommerce.php with some if is_search() and some
   if !is_search() functions.
 * I will add another private comment with links to show you the difference between
   the languages (I am just the developer not the owner of the site so I don’t want
   to post links to it here)
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791166)
 * OK I forgot that there is no private reply here so I am sending you links in 
   a message to show the problem.
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791174)
 * I will add links here as I can’t find where to message you as well 🙂
    Later 
   I will erase the links once you see them:
 * Main language (Hebrew):
    [http://winners-auctions.com/?s=&product_cat=%D7%9E%D7%9B%D7%99%D7%A8%D7%94-%D7%9E%D7%A1%D7%A4%D7%A8-085&product_tag=%D7%9B%D7%AA%D7%95%D7%91%D7%95%D7%AA](http://winners-auctions.com/?s=&product_cat=%D7%9E%D7%9B%D7%99%D7%A8%D7%94-%D7%9E%D7%A1%D7%A4%D7%A8-085&product_tag=%D7%9B%D7%AA%D7%95%D7%91%D7%95%D7%AA)
 * English:
    [http://winners-auctions.com/en/?s=&product_cat=auction-no-085&product_tag=ketubot](http://winners-auctions.com/en/?s=&product_cat=auction-no-085&product_tag=ketubot)
 * Here I am showing you the same category and same tag filtered in the corresponding
   language so you can see the exact same search results but the page layout is 
   wrong in English.
    I found that the English page is showing the content that 
   is defined under the !is_search and the Hebrew page shows the correct content
   from the is_search definition that I made. Another thing that affects the CSS
   and also a definition used in woocommerce.php is that in Hebrew the body class
   contains “archive tax-product_cat” and in English those are missing.
 * Any idea?
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791206)
 * Looking at your html source (the body tag), your problem seems not to be the 
   search (the class is present) but rather the classes related to taxonomies which
   disappear. No idea why as I can’t reproduce on a simple install (with Polylang
   as only plugin).
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791213)
 * maybe it is a problem with interaction with Woocommerce?
 * Any idea at all?
    In Hebrew which is the main language there is no problem at
   all…
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791227)
 * Not specifically with Woocommerce. But further tests showed me that this bug 
   appears for custom taxonomies (not categories and tag which I initially tested).
   I will go on working on this and come back to you.
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791229)
 * I understand, indeed we are using the custom taxonomies such as the product_cat
   and product_tag and not the regular wordpress category and tag taxonomies.
 * Looking forward to your solution!
 * Is it okay to remove the links that I added above?
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791235)
 * > Is it okay to remove the links that I added above?
 * Yes if you are able to.
    Could you please test the new development version (1.6.4.3)?
   [https://downloads.wordpress.org/plugin/polylang.zip](https://downloads.wordpress.org/plugin/polylang.zip)
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791244)
 * I wasn’t aware but the Edit option for posts is available for only one hour after
   it was posted so can’t erase the links… never mind.
 * Now after this new version we are almost there! A great improvement.
 * Now infact the is_search is working and we can see that the “archive” definition
   is in the body class.
    The more important definition is still missing from the
   body class, it is for the following usage for the layout:
 * `if (in_array('tax-product_cat',$classes)) {`
 * I use this to differentiate between regular search results layout and the layout
   of this custom filter which is based on the search function.
 * You think that this can also be resolved? I think that it is still related to
   the custom taxonomies but you should know better…
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791245)
 * By the way, you can see in the English page now 2 search fields, one should be
   there when it is not (in_array(‘tax-product_cat’,$classes)), for the regular 
   search results but it is showing because the tax-product_cat is missing from 
   the body class.
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791247)
 * While it is not the best solution for me, for now I will change the condition
   to check if we have “archive” in the body class as in the regular search it doesn’t
   have it so it will still differentiate the results layout.
 * Please update me if you managed to fix the tax-product_cat issue.
 * I wish to thank you now but I will save it for when I mark this topic as solved
   🙂
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791251)
 * OK sorry for the flood, one last update:
 * If I use the search in the header, Hebrew and English results are fine as both
   are without “archive” in body class.
    When using the search inside a category
   there is a problem as those results do have archive in them but they don’t have
   tax-product_cat and hence it doesn’t have the correct layout that it should have.
 * Hope that you manage to sort it and fix so that all the taxonomies from are taken
   to the secondary language as well as this is the only way to fix my issue here…
   
   Thanks!
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791263)
 * Could you try the new development version (1.6.4.4)?
    [https://downloads.wordpress.org/plugin/polylang.zip](https://downloads.wordpress.org/plugin/polylang.zip)
 *  Thread Starter [eavinu](https://wordpress.org/support/users/eavinu/)
 * (@eavinu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791265)
 * Just like magic!
    Perfect!
 * You can look now in the 2 links and now we can actually match the body classes
   in both languages and also the is_serach is working as it should for woocommerce
   🙂
 * I am happy to have been able to raise an issue which promoted your code closer
   to perfection…
 * Thank you thank you thank you and again thank you!

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘is_search problem’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 15 replies
 * 2 participants
 * Last reply from: [eavinu](https://wordpress.org/support/users/eavinu/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/is_search-problem/#post-5791265)
 * Status: resolved