Support » Plugin: Better Search » Exclude a search form from Better Search?

  • I would like to make a custom search form that only searches one post type, but Better Search overrides any custom search forms I create. Is there a way to exclude a particular search form from using Better Search’s functionality?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay

    (@ajay)

    Actually it doesn’t have to do with search forms but the search functionality which calls Better Search automatically.

    How are you building your search form? One option is to use a custom search template and a WP_Query in the search template to produce those search results.

    I’ve created my own search form using get_search_query(). I was trying to restrict it to posts only by using pre_get_posts but I couldn’t get it to work. I suppose I can build it completely from scratch and not use get_search_query(). Is that what you suggest?

    Plugin Author Ajay

    (@ajay)

    I use this in my other plugin that uses a custom post type but I think can apply for others: https://github.com/WebberZone/knowledgebase/blob/master/includes/public/templates/wzkb-search.php

    You would need to create a custom template within your theme which should, in theory, work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.