2

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
  • I want it hidden because I want each post to have a different term and therefore I don't want the author to choose a term that has already been used.
    – Pete
    Commented Mar 1, 2016 at 23:02

1 Answer 1

2

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!

1
  • 2
    The 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 the keydown event handler on the tag input box would also work).
    – bonger
    Commented Mar 1, 2016 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.