> For the complete documentation index, see [llms.txt](https://knowledgebase.ajaxsearchpro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.ajaxsearchpro.com/hooks/filters/search-results/asp_result_groups.md).

# asp\_result\_groups

Accessing the results groups when the results [grouping](https://documentation.ajaxsearchpro.com/advanced-options/grouping-results) is enabled.

```php
apply_filters('asp_result_groups', array $groups, int $id, array $args);
```

### Parameters

* **$groups**(array) - Array containing the results grouped
* **$id**(int) - Search instance ID
* **$args** (array) - Search arguments

### Usage

```php
add_filter( 'asp_result_groups', 'asp_result_groups_modify', 10, 1 );
function asp_result_groups_modify( $groups) {
	foreach ($groups as $slug=>&$group) {
		/**
		 * $slug (string) = 'group_slug',
		 * $group (array) [
		 *      'title' => 'Group header title',
		 * 			'items' => array(...) // The actual results
		 * ]
		 **/
		if ( $group['title'] == 'Group title' ) {
			// Change the group title
			$group['title'] == 'Modified group title';
			
			// Unset items from group where post ID is 123
			foreach ( $group['items'] as $k=>&$r ) {
				if ( $r->id == 123 ) {
					unset($group['items'][$k]);
				}
			}
		}
	}

	return $groups ;
}
```
