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

Reply To: asp_query_args IS NOT WORKING

#25368
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Well, there are a few unneccesary lines there, as well as I am not sure the the wp_get_post_categories returns the array of category IDs by default. Try this modification:

add_filter("asp_query_args", "asp_query_args_change", 10, 2);
function asp_query_args_change($args, $search_id) {
	$post_id = $args['_page_id'];
	if ($search_id == 3) {
	  $args['post_type'] = array('post');
	  $args['post_fields'] = array('title', 'content', 'excerpt', 'terms');
	  $args['post_tax_filter'] = array(
		array(
			'taxonomy'  => 'category',
			'include'   => wp_get_post_categories($post_id, 'ids')
		)
	  );
	}
	return $args;
}