Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Modify WHERE clause › Reply To: Modify WHERE clause
November 30, 2020 at 10:28 am
#30421
Keymaster
Hi Héctor,
You can add fields to the final query, there are multiple ways, these are not documented yet unfortunately. I recommend using these hooks:
$add_select = apply_filters('asp_cpt_query_add_select', '', $args, $phrase, $phrase_array);
$add_join = apply_filters('asp_cpt_query_add_join', '', $phrase, $phrase_array);
$add_where = apply_filters('asp_cpt_query_add_where', '', $phrase, $phrase_array);
You can add a hook to them like so:
add_filter('asp_cpt_query_add_join', 'my_asp_cpt_query_add_join', 10, 4);
function my_asp_cpt_query_add_join($query, $args, $phrase, $phrase_array) {
global $wpdb;
// Return the join query you want
return "LEFT JOIN ...";
}