asp_terms_results

Let's you access the term results results array before sending it to the templating system.
apply_filters('asp_terms_results', $results, $search_id, $args);

Parameters

  • $results (array) - Array containing the result objects.

  • $search_id (int) - Search instance ID

  • $args (array) - Search arguments

Usage

add_filter( 'asp_terms_results', 'asp_term_result_filter', 10, 3 );
function asp_term_result_filter( $results, $search_id, $args ) {
$link = 'https://www.google.com/'; // Link to use, when not logged in
// Parse through each result item
foreach ($results as $k=>&$r) {
/**
* $r (stdClass object) {
* 'id' -> Term ID,
* 'title' -> Result title
* 'content' -> Result content
* 'taxonomy' -> Term Taxonomy
* 'content_type' -> Content type (pagepost, user, term, attachment etc..)
* }
**/
if ( !is_user_logged_in() )
$r->link = $link;
}
return $results;
}