Is there a way to alter the search.php file so it allows people to search based on an image title, caption, alt text or description, and receive the related result (image) from the ACF Gallery?

Example: I have a hardwood company website, if the user searches for ‘Red Oak’, return all product images that contain the image title ‘Red Oak’.

Thanks in advance!

Below is the code i have that's just searching through my custom post type "products". Within each custom post type is a gallery of images.

    $s = get_search_query();
    $args = array(
            'post_type' => 'products',
            'post_status' => 'publish',
            'order' => 'ASC',
            'posts_per_page' => -1,
            's' => $s
    $the_query = new WP_Query( $args );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.