Keyword Suggestions
Keyword suggestion and autocomplete hooks
Hook to the final suggested keywords from all selected sources.
add_filter('asp/suggestions/keywords', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
return $keywords;
}
- $keywords (array) - the array of the suggersted keywords
- $phrase (string) - the search phrase
add_filter('asp/suggestions/post_type/query', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $query, $phrase) {
return $query;
}
- $query (string) - the final query before execution
- $phrase (string) - the search phrase
add_filter('asp/suggestions/post_type/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $posts, $phrase ) {
return $posts;
}
- $keywords (array) - the array of the suggersted keywords
- $posts (array[object]) - Array of Posts (ID and post_title)
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)
add_filter('asp/suggestions/taxonomy/results', 'asp_change_keyword_suggestions', 10,4);
function asp_change_keyword_suggestions( $query, $phrase, $taxonomy, $args ) {
return $query;
}
- $query (string) - the final query before execution
- $phrase (string) - the search phrase
- $taxonomy (string) - the taxonomy name
- $args (array) - the arguments
add_filter('asp/suggestions/statistics/query', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $query, $phrase) {
return $query;
}
- $query (string) - the final query before execution
- $phrase (string) - the search phrase
add_filter('asp/suggestions/statistics/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
return $posts;
}
- $keywords (array) - the array of the suggersted keywords
- $posts (array) - Array of suggested keywords
add_filter('asp/suggestions/google/url', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $url, $args) {
return $url;
}
- $url (string) - the google suggestions URL
- $args (array) - the array of arguments for the suggestion
add_filter('asp/suggestions/google/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
return $keywords;
}
- $keywords (array) - the array of the suggersted keywords
- $phrase (string) - the search phrase
add_filter('asp/suggestions/google_places/url', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $url, $args) {
return $url;
}
- $url (string) - the google suggestions URL
- $args (array) - the array of arguments for the suggestion
add_filter('asp/suggestions/google_places/results', 'asp_change_keyword_suggestions', 10, 2);
function asp_change_keyword_suggestions( $keywords, $phrase ) {
return $keywords;
}
- $keywords (array) - the array of the suggersted keywords
- $phrase (string) - the search phrase
Last modified 7mo ago