jQuery Autocomplete in WordPress

don’t include WP like that. use $_GET instead:

...
$("#tags").autocomplete("<?php echo add_query_arg('get_my', 'terms', home_url()); ?>", 
...

theme’s functions.php:

add_action('template_redirect', 'terms_for_autocomplete');
function terms_for_autocomplete(){
  if(isset($_GET['get_my']) && $_GET['get_my'] == 'terms'):

    $terms = &get_terms(get_taxonomies());
    foreach ($terms as $term)
      echo "{$term->name}|{$term->name} ({$term->count} results)\n";

    die();
  endif;
}

Leave a Comment