# Keyword Suggestions

## All suggestions

### asp/suggestions/keywords

Hook to the final suggested keywords from all selected sources.

```php
add_filter('asp/suggestions/keywords', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
	return $keywords;
}
```

#### Parameters

* **$keywords** (array) - the array of the suggersted keywords
* **$phrase** (string) - the search phrase

## Post Title Suggestions

### asp/suggestions/post\_type/query

```php
add_filter('asp/suggestions/post_type/query', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $query, $phrase) {
	return $query;
}
```

#### Parameters

* **$query** (string) - the final query before execution
* **$phrase** (string) - the search phrase

### asp/suggestions/post\_type/results

```php
add_filter('asp/suggestions/post_type/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $posts, $phrase ) {
	return $posts;
}
```

#### Parameters

* **$keywords** (array) - the array of the suggersted keywords
* **$posts** (array\[object]) - Array of Posts (ID and post\_title)

{% hint style="danger" %}
WARNING! The **$post** argument in this hook is **not an array of WP\_Post** objects! The items only have the ID and title columns ($post->ID, $post->post\_title)
{% endhint %}

## Taxonomy Term Suggestions

### asp/suggestions/taxonomy/results

```php
add_filter('asp/suggestions/taxonomy/results', 'asp_change_keyword_suggestions', 10,4);
function asp_change_keyword_suggestions( $query, $phrase, $taxonomy, $args ) {
	return $query;
}
```

#### Parameters

* **$query** (string) - the final query before execution
* **$phrase** (string) - the search phrase
* **$taxonomy** (string) - the taxonomy name
* **$args** (array) - the arguments

## Search Statistics Suggestions

### asp/suggestions/statistics/query

```php
add_filter('asp/suggestions/statistics/query', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $query, $phrase) {
	return $query;
}
```

#### Parameters

* **$query** (string) - the final query before execution
* **$phrase** (string) - the search phrase

### asp/suggestions/statistics/results

```php
add_filter('asp/suggestions/statistics/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
	return $posts;
}
```

#### Parameters

* **$keywords** (array) - the array of the suggersted keywords
* **$posts** (array) - Array of suggested keywords

## Google Suggestions

### asp/suggestions/google/url

```php
add_filter('asp/suggestions/google/url', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $url, $args) {
	return $url;
}
```

#### Parameters

* **$url** (string) - the google suggestions URL
* **$args** (array) - the array of arguments for the suggestion

### asp/suggestions/google/results

```php
add_filter('asp/suggestions/google/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
	return $keywords;
}
```

#### Parameters

* **$keywords** (array) - the array of the suggersted keywords
* **$phrase** (string) - the search phrase

## Google Places API Suggestions

### asp/suggestions/google/url

```php
add_filter('asp/suggestions/google_places/url', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $url, $args) {
	return $url;
}
```

#### Parameters

* **$url** (string) - the google suggestions URL
* **$args** (array) - the array of arguments for the suggestion

### asp/suggestions/google/results

```php
add_filter('asp/suggestions/google_places/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
	return $keywords;
}
```

#### Parameters

* **$keywords** (array) - the array of the suggersted keywords
* **$phrase** (string) - the search phrase


---

# 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/keyword-suggestions.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.
