I have created a simple frontend form to allow users to submit posts - similar to the tutorial here - http://voodoopress.com/ . I also have a couple of custom taxonomies which i have as text input boxes on my form. This is all working but i was wondering if there is anyway i can have all the fields including Post Title and the taxonomies to auto suggest existing values?


  • How do you mean to auto-suggest? As in, if someone starts creating a new post, you query for similar post titles and recommend those?
    – mor7ifer
    Commented Feb 6, 2012 at 16:34
  • yes that is correct. Also similar for my other text boxes. eg i have an artist field which i would like to pull terms from my Artists taxonomy when a user starts typing
    – coolGeek
    Commented Feb 6, 2012 at 17:22

2 Answers 2


Ok not sure if this is the best method to use but it worked for me. I used a combition of jquery-ui-autocomplete - and the JSON API plugin

First download the required js files from the link above. I used jqueri-ui from the Google library Install and activate JSON API plugin

I then used the following javascript to auto suggest when typing into the "title" input field on my custom post form

<script type="text/javascript">
$(function() {
        source: function( request, response ) {
                url: "http://example.com/?json=1&include=title",
                dataType: "json",
                data: {
                    featureClass: "P",
                    style: "full",
                    maxRows: 12,
                    name_startsWith: request.term
            success: function( data ) {
            response( $.map( data.posts, function( item ) {
                return {
                            label: item.title,
                            value: item.title
        minLength: 2,

Next step is to get this working with custom taxonomies!


I've spent a bit digging around on this and I think I've found your solution! It seems that get_terms()'s name__like parameter is going to be the way to go. name__like's query is as follows (from line 1304 of /wp-includes/taxonomy.php): $wpdb->prepare( " AND t.name LIKE %s", $name__like . '%' );. It will take whatever you give it as the name__like parameter, and add an SQL wildcard, %, to it. This means that it will look for everything that STARTS with what you feed it.

That pretty much settles getting the data...unfortunately it doesn't handle passing it to javascript. I'm not sure exactly how you're handling that aspect of insertion, but I think I would pass out a an array just containing the names and let the discrimination of 'do I create a new term or use the old one?' be handled on submission. If you tell me which parts of this aren't clear (I'm sure there will be some), I can try to give you some pseudo-code, but I don't have time to write this whole thing up, unfortunately.

  • Hi thanks for your suggestions. I couldnt get it working with using name__like although i don't really know what im doing to be honest! I did however get this to work using the JSON API plugin and jquery-ui-autocomplete
    – coolGeek
    Commented Feb 7, 2012 at 15:11
  • You should submit your solution as a solution and mark the question solved so that anyone who comes after you looking to do the same thing will have a leg up.
    – mor7ifer
    Commented Feb 8, 2012 at 0:02

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.