Title: Prevent from empty search
Last modified: August 21, 2016

---

# Prevent from empty search

 *  Resolved [katalonian](https://wordpress.org/support/users/katalonian/)
 * (@katalonian)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/prevent-from-empty-search/)
 * Hi there! Thanks for an amazing plugin!
    I’m curious, there is a way to prevent
   search if search field is empty? I tried to use **empty_search_url** and i put
   a link, but it not seems to be working. Thanks a lot!
 * [https://wordpress.org/plugins/search-filter/](https://wordpress.org/plugins/search-filter/)

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

 *  Plugin Author [Ross Morsali](https://wordpress.org/support/users/designsandcode/)
 * (@designsandcode)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/prevent-from-empty-search/#post-4959795)
 * Hey katalonian
 * There is no way to prevent an empty search, but if an empty search is performed
   then the URL should redirect to the url set in `empty_search_url`…
 *  Thread Starter [katalonian](https://wordpress.org/support/users/katalonian/)
 * (@katalonian)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/prevent-from-empty-search/#post-4959855)
 * Thanks for a quick reply.
    I shall put full url to **empty_search_url ** or just
   a part of url like /page/ ? Cheers!
 *  Thread Starter [katalonian](https://wordpress.org/support/users/katalonian/)
 * (@katalonian)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/prevent-from-empty-search/#post-4959856)
 * No, it doesn’t work for me either way 🙁
 *  Thread Starter [katalonian](https://wordpress.org/support/users/katalonian/)
 * (@katalonian)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/prevent-from-empty-search/#post-4959857)
 * It’s weird, because i took away search field, and even if i just press button
   submit without selecting a categories, it’s still gives a different page. I still
   can’t realize which page it opens.
 * UPDATE
 * It’s opens index.php file, so, i’ll try to handle it. but would be nice if
    empty_search_url
   would work 🙂
 *  Plugin Author [Ross Morsali](https://wordpress.org/support/users/designsandcode/)
 * (@designsandcode)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/prevent-from-empty-search/#post-4959894)
 * Hey katalonian
 * `empty_search_url` should be used like this:
 *     ```
       [searchandfilter fields="category,post_tag" empty_search_url="http://www.yoursite.com/"]
       ```
   
 * And when a user performs a search, where there is no selection or search term
   the page should redirect here…
 * Can you paste in the shortcode you are using?
 * 🙂

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

The topic ‘Prevent from empty search’ is closed to new replies.

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

 * 5 replies
 * 2 participants
 * Last reply from: [Ross Morsali](https://wordpress.org/support/users/designsandcode/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/prevent-from-empty-search/#post-4959894)
 * Status: resolved