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

Reply To: Display posts based on custom field

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Display posts based on custom field Reply To: Display posts based on custom field

#41154
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Unfortunately the only way of filtering this is programmatically, by removing results after the search is finished, by checking for the “title_field” existence.

Something like this:

add_filter('asp_results', 'asp_remove_where_no_title_field');
function asp_remove_where_no_title_field($results) {
    foreach($results as $k=>&$r){
        if ( get_post_meta($r->id, 'title_field', true) == '' ) {
			unset($results[$k]);
		}
    }
    return $results;
}