Support » Plugin: Advance WP Query Search Filter » Search in custom meta field – two input text field

  • Hi,

    I needed to add another keyword search field to the form to search within custom meta field -> ‘my_city_meta_field‘. I managed to add this field by including these 2 lines of code to searchform.php:

    echo '<center><label class="awqsf-label-keyword">City</center></label>'
    echo '<input id="my_city_meta_field" type="text" name="my_city_meta_field" value="" />';

    All is working great. I can search within posts that have specific ‘City’ name but… I have other filters like taxonomy checkboxes etc. The problem is when I type i.e. New York in this field and check other filters. Then wp returns only those posts with the city specified and just skips other filters. It looks like my custom search field and standard awpqf filters aren’t combined as a single search query. What else do I have to edit to get the results that meets all the search criteria?

    Sorry for my bad english 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author TC.K


    Yes, by default when using keyword search, it will automatically ignored custom meta field and taxonomy. Thus, only entered keyword will be searched.

    hmm, is it possible to stop this default behavior and have all the filters included to the search query?

    Plugin Author TC.K


    Yes, it is possible.

    In plugn folder/includes/process.php

    look for line 145 & line 165, replace with this :

    $tax_query = isset($get_tax)  ? $get_tax : null;
    $meta_query = isset($get_meta)  ? $get_meta : null;

    Note that when you using this, the search will become very sensitive. The search must met the requirement of the input of taxonomy AND keyword in order to give you the result.

    I just wanted to say that you are one of the few awesome devs. Why you might ask? Because you support your plugin. I know it’s not easy but keep up the good work, your doing great.

    Thanks for this, but unfortunatelly it doesn’t solved my problem.

    In the plugin’s setting page I can ‘add custom meta’ as: dropdown, radio button or checkbox but I need it to be an input text field. Is it possible?

    Plugin Author TC.K


    Sure, it is possible, but required customization. It will be complicated to explain here due to many files need to be edit.

    Maybe in the future I will add filter hook into this plugin, so that it will have the ability to customize without changing the core file.

    Will you be willing to make this customization for me?
    I will pay you for this of course 🙂

    Please contact the plugin’s developer directly via email or try or

    This topic has now been closed as per the Forum Rules

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Search in custom meta field – two input text field’ is closed to new replies.