# 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 ;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.ajaxsearchpro.com/hooks/filters/search-results/asp_result_groups.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
