Support

Account

Home Forums Feature Requests Advanced Search for custom fields

Helping

Advanced Search for custom fields

  • Hi Elliot

    Absolutely love the plugin, it is one of the best plugins I’ve used in WordPress, thanks for your hard work.

    I have a question, wondering if it would ever be possible to do, to do with searching.

    I’m currently in the process of creating a website for a real estate, using WordPress, and am trying to stay away from using plugins like WP-Property. I actually like to have the least amount of plugins as possible and try and hard code everything into the template – ACF is probably the only plugin i’d want to use.

    Would it be a silly request or feature idea to set up some sort of functionality that would allow you to set up a custom fields search?

    For example, I’ve created a bunch of fields for a property for sale:
    Address, Price, Featured Image, Number of Bedrooms, Number of Bathrooms etc.

    I was hoping to set up functionality to allow the front end users to narrow down an advanced search that could search these fields and display them in search results if they match their criteria.

    Maybe this is completely out of scope for your plugin – but thought I might ask anyway.

    Thanks very much, Appreciate your time.

    Kind Regards,
    Sean

  • Hi @mrdigitalau

    Thanks for the question. This is within the scope and I have done it many times with ACF and WP.

    WP has a get_posts function / WP_Query which accepts a meta_query argument.

    This allows you to search custom field data. There is a resource article which should how to do some querying, so that would be a good place for you to start.

    After that, you need to create a custom page template, or use an archive as a place to render the loop and then find a way to pass arguments to the query either by AJAX, or by url $_GET param.

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Advanced Search for custom fields’ is closed to new replies.