my website theme has an Ajax search bar. My search bar does not seem to work properly when searching for products containing apostrophes and quotes in the title.


Title of a product is 4'x4' Grow Tent I will type 4' into my live search bar, and when I click on the actual product that shows up in the dropdown live search bar, I am directed to a page saying "No products found".

Any ideas? I've been searching for days with no luck.

1 Answer 1


Try to apply some function like htmlspecialchars() on your query before searching for it, it will translate your special chars into HTML entities.

  • Escaping will also increase the security of your code.
    – luke
    Commented Apr 29, 2015 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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