Title: Add More Search Fields
Last modified: August 30, 2016

---

# Add More Search Fields

 *  [xw7](https://wordpress.org/support/users/xw7/)
 * (@xw7)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/)
 * Is it possible to add more search fields to Simple Locator? At the moment it’s
   set to postcode and distance but I require a few more fields – if so could you
   let me know which file I would need to modify or which part of the file.
 * Thank you.
 * [https://wordpress.org/plugins/simple-locator/](https://wordpress.org/plugins/simple-locator/)

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

 *  Plugin Author [Kyle Phillips](https://wordpress.org/support/users/kylephillips/)
 * (@kylephillips)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416124)
 * Additional search fields are not currently possible.
 *  Thread Starter [xw7](https://wordpress.org/support/users/xw7/)
 * (@xw7)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416132)
 * Thanks for your response Kyle, which file(s) control the search fields as we 
   have managed to add more select boxes but the values are not pulling through 
   at the moment and is pinging back as null.
 * Any help would be appreciated.
 *  Plugin Author [Kyle Phillips](https://wordpress.org/support/users/kylephillips/)
 * (@kylephillips)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416136)
 * Not sure I understand the question fully.
 * If you’re adding additional select fields to the search form manually, the data
   will be lost in the form processing… the search query itself would need to be
   manually updated to include that criteria. That would become pretty complex.
 *  Thread Starter [xw7](https://wordpress.org/support/users/xw7/)
 * (@xw7)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416147)
 * We are able to update the search Query and PHP just need to know which files 
   control the search. We have managed to update the SQL to include more fields 
   from database but only if input manually into SQL Query. When we try and pull
   in the value from the form it doesn’t pull our extra values in, only the values
   from your initial fields which made us think there is another file controlling
   what is pulled through the form. Hope this makes sense.
 *  Plugin Author [Kyle Phillips](https://wordpress.org/support/users/kylephillips/)
 * (@kylephillips)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416173)
 * There are separate views for AJAX and non-ajax forms, both in the “views” directory.
   It sounds like you’re using the non-ajax version.
 * Search functionality is contained within the app/Services/LocationSearch directory/
   namespace. There is a form listener class in the Listeners directory/namespace
   called LocationSearch that handles some of the form data.
 * I’m sure you’re aware, any updates to the plugin will override these changes 
   you’re making.
 *  Thread Starter [xw7](https://wordpress.org/support/users/xw7/)
 * (@xw7)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416280)
 * Kyle, we made the usual changes but assume we are going wrong somwhere as it 
   isnt working. We changed the following files and added into the sections stated–
   are we missing anything obvious?
 * Field is called property_bedrooms in the database and the file being pulled in
   is pyb but it doesn’t seem to pull the value through.
 * If we set the code below to the following manually it works property_bedrooms
   >= ‘3’
 * I have a feeling some of the edits below may not be required but trying everything
   to get it to work.
 * Any help would be appreciated.
 *     ```
       LocationSearch.php
   
       - Sanitize and set the user-submitted data
       'pyb' => sanitize_text_field($_POST['pyb']),
   
       - added this to SET QUERY DATA
       $this->query_data['pyb'] = $this->data['pyb'];
   
       - Added this to set the query
       AND property_bedrooms >= 'pyb'
       ```
   
 *     ```
       simple-locator-form.php / FORM
   
       <select name="pyb">
       <option value="1">1</option>
       <option value="6">6</option>
       <option value="9">9</option>
       </select>
       ```
   
 *  Thread Starter [xw7](https://wordpress.org/support/users/xw7/)
 * (@xw7)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416282)
 * Managed to fix it! Simple mistake to make, got it working now and it’s pulling
   it all in.
 *  [itsazzad](https://wordpress.org/support/users/itsazzad/)
 * (@itsazzad)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416333)
 * [@xw7](https://wordpress.org/support/users/xw7/) What changes did you made it
   to work?

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

The topic ‘Add More Search Fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-locator_279078.svg)
 * [Simple Locator](https://wordpress.org/plugins/simple-locator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-locator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-locator/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-locator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-locator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-locator/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [itsazzad](https://wordpress.org/support/users/itsazzad/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/add-more-search-fields/#post-6416333)
 * Status: not resolved