asp_comment_results
Gives access the comment results results array before sending it to the templating system.
1
apply_filters('asp_comment_results', $results, $search_id, $args);
Copied!

Parameters

  • $results (array) - Array containing the result objects.
  • $search_id (int) - Search instance ID
  • $args (array) - Search arguments

Usage

1
add_filter( 'asp_comment_results', 'asp_comment_result_filter', 10, 3 );
2
function asp_comment_result_filter( $results, $search_id, $args ) {
3
$link = 'https://www.google.com/'; // Link to use, when not logged in
4
5
// Parse through each result item
6
foreach ($results as $k=>&$r) {
7
/**
8
* $r (stdClass object) {
9
* 'id' -> Term ID,
10
* 'title' -> Result title
11
* 'content' -> Result content
12
* 'post_type' -> Post Type
13
* 'content_type' -> Content type (pagepost, user, term, attachment etc..)
14
* }
15
**/
16
if ( !is_user_logged_in() )
17
$r->link = $link;
18
}
19
20
return $results;
21
}
Copied!
Last modified 1yr ago
Copy link