This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Modify WHERE clause

#30421
Ernest MarcinkoErnest Marcinko
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 ...";
}