Make WordPress Core

Changeset 5756


Ignore:
Timestamp:
06/25/2007 09:28:19 PM (17 years ago)
Author:
ryan
Message:

Add name_like query to get_terms(). Use it in suggestCategories.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r5741 r5756  
    227227        'hide_empty' => true, 'exclude' => '', 'include' => '',
    228228        'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
    229         'hierarchical' => true, 'child_of' => 0, 'get' => '');
     229        'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name_like' => '');
    230230    $args = wp_parse_args( $args, $defaults );
    231231    $args['number'] = (int) $args['number'];
     
    309309        $where = " AND t.slug = '$slug'";
    310310    }
     311
     312    if ( !empty($name_like) )
     313        $where = " AND t.name LIKE '{$name_like}%'";
    311314
    312315    if ( '' != $parent ) {
  • trunk/xmlrpc.php

    r5729 r5756  
    547547        }
    548548
    549         $category_suggestions = $wpdb->get_results("
    550             SELECT cat_ID category_id,
    551                 cat_name category_name
    552             FROM {$wpdb->categories}
    553             WHERE cat_name LIKE '{$category}%'
    554             {$limit}
    555         ");
     549        $category_suggestions = get_categories("get=all&number=$max_results&name_like=$category");
    556550
    557551        return($category_suggestions);
Note: See TracChangeset for help on using the changeset viewer.