When I start to type in a few letters in the tag or term metabox (in the post edit page) there is a predictive autocomplete popup thingy containing other tags/terms to choose from. How do I disable/hide this?
1 Answer
There is no filter or way to stop those Ajax calls. However, you can alter the response of Ajax call by using filter term_search_min_chars
.
Which is actually to customize minimum number of characters after that Ajax will print the response. So we can make it 0
to never print the response!
/**
* Remove tag search suggestions
* @param int $tax The minimum number of characters required. Default 2.
* @return int
*/
function remove_tag_suggestions($tax) {
//You can place your condition if you want!
return 0;
}
add_filter('term_search_min_chars', 'remove_tag_suggestions');
PS: I am not sure why do you want to remove this wonderful feature!
-
2The way to go but note you can always filter ajax calls client-side with various jQuery functions, eg
$.ajaxPrefilter(function (options, originalOptions, jqXHR) { if (options.url.indexOf('action=ajax-tag-search') !== -1) jqXHR.abort(); });
... (removing thekeydown
event handler on the tag input box would also work).– bongerCommented Mar 1, 2016 at 19:28