Search through custom post type and custom fields takes 5 minutes

You got a preg_match_all(), various JOINs, anonymous/lambda functions. In short: Everything that makes debugging hard and is performance wise a no-go.

In short: You should use a meta_query instead. Take a look at

Code meta_query » Multiple Custom Field Handling:

Leave a Comment