I've using the Events Manager plugin which creates a custom post type of 'event' and a custom taxonomy called 'event-categories'.
I have the category 'courses' which has an ID of 43. I also have a number of child categories under courses e.g. 'science', 'english' etc.
I'm creating an autocomplete search and need to query courses based on the search term but only on posts that appear in the the post type of event, taxonomy of 'event-categories' and are tagged with the 'courses' category or any of its children.
Here is what I have so far:
global $wpdb, $table_prefix;
$em_suggestions = $wpdb->get_results("
SELECT post_name as value, post_title as label
FROM {$table_prefix}posts
WHERE post_type = 'event'
AND post_status = 'publish'
AND post_title LIKE '%$term%'
ORDER BY post_title ASC
LIMIT 0, 10
");
I'm just struggling to apply the taxonomy filter to it.