WordPress.org

Make WordPress Core

Ticket #13580: admin-ajax_ajax-tag-search.diff

File admin-ajax_ajax-tag-search.diff, 915 bytes (added by brianlayman, 5 years ago)

Adds two options for altering tag search behavior defaulting the values to wp 2.x defaults

  • admin-ajax.php

     
    6666                $s = $s[count( $s ) - 1]; 
    6767        } 
    6868        $s = trim( $s ); 
    69         if ( strlen( $s ) < 2 ) 
    70                 die; // require 2 chars for matching 
     69        if ( strlen( $s ) < get_option('ats_min_chars', 2) ) 
     70                die; // require 'ats_min_chars' chars for matching (default 2) 
    7171 
    72         $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = '$taxonomy' AND t.name LIKE ('%" . $s . "%')" ); 
     72        $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = '$taxonomy' AND t.name LIKE ('%" . $s . "%') and tt.count > " . get_option('ats_min_count', 0) ); 
    7373 
    7474        echo join( $results, "\n" ); 
    7575        die;