Support

Account

Home Forums General Issues MySql Query for custom search engine

Helping

MySql Query for custom search engine

  • Hi everybody,

    i need your help, i need to create a frontend search engine for users. I created a custom fields in a specific category of my website. Ex. Cat: Cars: Field 1: Color: Field 2: Price;

    I need to retrieve in a page 2 select, and these select will be populated with every custom field values.

    Ex.

    <select name=”color”>
    <option>blue</option>
    <option>red</option>

    </select>

    <select name=”price”>
    <option>15.000</option>
    <option>32.000</option>

    </select>

    I select Blue value, and 15.000 ad i need to retrieve every post with this values inside them

    Right, i don’t understand where the custom fields values are in my wordpress database!!!

    Can someone help me?

    Thanks a lot

  • Hi @filogti

    No worries. ACF is really just a UI for the native custom fields in WP. Therefore, you can use all the functions that WP offer to query posts in the DB based on custom fields.

    You should take a look at the get_posts function. It uses the same args as the WP_Query object and allows you to query the database.

    Good luck

    Cheers
    E

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

The topic ‘MySql Query for custom search engine’ is closed to new replies.