How can I build a search filter (something like this) with WordPress?

I have a custom post type name: "Locatii". It is a custom post type with categories.

Ex: Cat 1 , Cat 2 ... and so on.

How can I implement AJAX so that when I click Cat 1 ( checkbox) and Cat 2 I should retrieve the posts that are in that categories, without having a search button.

2 Answers 2


You'll need to hook into the "onchange" event of javascript. When using jquery, it's as simple as $('<the selector string>').change(function(){});

When ever the values are changed, you'll do an AJAX request to the server with the new parameters & populate the output screen with the new result. For the server-side, you'll check the parameters, do some validations & send the response after reading the data from the database.

This codex article will help http://codex.wordpress.org/AJAX_in_Plugins

  • Thanks for your answer, can you give me more details PHP code or a link ... I am not a great connoisseur of Ajax language.
    – Batman
    Nov 24, 2012 at 21:18
  • 2
    Please go through the link provided in the answer & then add to the question some code that you've tried so far Nov 24, 2012 at 21:25
  • Ok, i will do that, i will come with an answer... thanks
    – Batman
    Feb 15, 2013 at 15:57

I'd suggest starting with the Query Multiple Taxonomies plugin. As far as I know it doesn't use AJAX, but you could try to extend it to add AJAX support.

  • 2
    Answers should be more than plain links. They should actually be an answer instead of a route where someone will maybe find an answer. Please help preventing link rot, edit your answer and provide the needed information that helps the OP as well as later visitors to solve their problem.
    – kaiser
    Oct 1, 2014 at 20:56

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.