Make WordPress Core


Ignore:
Timestamp:
12/18/2008 07:12:26 PM (16 years ago)
Author:
ryan
Message:

Allow muliple tag-like taxonomies in the post editor. see #6387

File:
1 edited

Legend:

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

    r10204 r10222  
    4545
    4646    $s = $_GET['q']; // is this slashed already?
     47   
     48    if ( isset($_GET['tax']) )
     49        $taxonomy = sanitize_title($_GET['tax']);
     50    else
     51        die('0');
    4752
    4853    if ( false !== strpos( $s, ',' ) ) {
     
    5358    if ( strlen( $s ) < 2 )
    5459        die; // require 2 chars for matching
    55     $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 = 'post_tag' AND t.name LIKE ('%". $s . "%')" );
     60
     61    $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 . "%')" );
     62
    5663    echo join( $results, "\n" );
    5764    die;
     
    491498        die('-1');
    492499
    493     $tags = get_tags( array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
     500    if ( isset($_POST['tax']) )
     501        $taxonomy = sanitize_title($_POST['tax']);
     502    else
     503        die('0');
     504   
     505    $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
    494506
    495507    if ( empty( $tags ) )
     
    777789
    778790    $_POST['post_category'] = explode(",", $_POST['catslist']);
    779     $_POST['tags_input'] = explode(",", $_POST['tags_input']);
    780791    if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
    781792        unset($_POST['post_category']);
Note: See TracChangeset for help on using the changeset viewer.