Make WordPress Core


Ignore:
Timestamp:
06/30/2008 12:04:22 AM (16 years ago)
Author:
markjaquith
Message:

Enable tag auto-suggest for multiple tags at once (without having to hit enter and send each one "down below"). fixes #5580

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r8011 r8214  
    1414    $s = $_GET['q']; // is this slashed already?
    1515
    16     if ( strstr( $s, ',' ) )
    17         die; // it's a multiple tag insert, we won't find anything
    18     $results = $wpdb->get_col( $wpdb->prepare("SELECT name FROM $wpdb->terms WHERE name LIKE (%s)", '%' . $s . '%') );
     16    if ( strstr( $s, ',' ) ) {
     17        $s = explode( ',', $s );
     18        $s = $s[count( $s ) - 1];
     19    }
     20    $s = trim( $s );
     21    if ( strlen( $s ) < 2 )
     22     die; // require 2 chars for matching
     23    $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%". $s . "%')" );
    1924    echo join( $results, "\n" );
    2025    die;
Note: See TracChangeset for help on using the changeset viewer.