Can I disable the auto complete?

I have a solution I tested, and it works.

The autocomplete for the tags is currently done via an ajax request to the file admin-ajax.php.
The solution I would suggest is to block the processing of the request so that it does not return any result. I would do :

function no_tag_suggest() {
    if( DOING_AJAX == true && $_GET['action'] == 'ajax-tag-search' && $_SERVER['HTTP_REFERER'] == admin_url( 'edit.php' ) ) {
        die;
    }
}    
add_action('admin_init', 'no_tag_suggest');

The previous function verify:

  1. if it is an ajax request
  2. if the action paramater is
    ‘ajax-tag-search’
  3. if the referer url is the
    ‘/wp-admin/edit.php’ page

If these 3 conditions are meet, no result will be returned and the tag suggestions not displayed.

If you want to remove this autocomplete from all the pages, not the ‘wp-admin/edit.php’ only, you can do:

function no_tag_suggest() {
    if( DOING_AJAX == true && $_GET['action'] == 'ajax-tag-search' ) ) {
        die;
    }
}    
add_action('admin_init', 'no_tag_suggest');

I would suggest you to look at the code of ‘admin-ajax.php’ to see all the ‘action’ parameters there, thus all the ajax requests you can kill with similar methods.

I hope my explanation was clear. Don’t hesitate to ask me if you want more details or have any question.

Bounty for me? 🙂

Leave a Comment

tech