AND get_terms() field queries

git-svn-id: http://svn.automattic.com/wordpress/trunk@5807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-07-17 02:02:52 +00:00
parent 460ddd3a1d
commit 7217266ca3
2 changed files with 6 additions and 6 deletions

View File

@ -226,7 +226,7 @@ function &get_terms($taxonomies, $args = '') {
$defaults = array('orderby' => 'name', 'order' => 'ASC', $defaults = array('orderby' => 'name', 'order' => 'ASC',
'hide_empty' => true, 'exclude' => '', 'include' => '', 'hide_empty' => true, 'exclude' => '', 'include' => '',
'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name_like' => ''); 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '');
$args = wp_parse_args( $args, $defaults ); $args = wp_parse_args( $args, $defaults );
$args['number'] = (int) $args['number']; $args['number'] = (int) $args['number'];
if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) || if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) ||
@ -306,15 +306,15 @@ function &get_terms($taxonomies, $args = '') {
if ( !empty($slug) ) { if ( !empty($slug) ) {
$slug = sanitize_title($slug); $slug = sanitize_title($slug);
$where = " AND t.slug = '$slug'"; $where .= " AND t.slug = '$slug'";
} }
if ( !empty($name_like) ) if ( !empty($name__like) )
$where = " AND t.name LIKE '{$name_like}%'"; $where .= " AND t.name LIKE '{$name__like}%'";
if ( '' != $parent ) { if ( '' != $parent ) {
$parent = (int) $parent; $parent = (int) $parent;
$where = " AND tt.parent = '$parent'"; $where .= " AND tt.parent = '$parent'";
} }
if ( $hide_empty && !$hierarchical ) if ( $hide_empty && !$hierarchical )

View File

@ -540,7 +540,7 @@ class wp_xmlrpc_server extends IXR_Server {
return($this->error); return($this->error);
} }
$args = array('get' => 'all', 'number' => $max_results, 'name_like' => $category); $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category);
$category_suggestions = get_categories($args); $category_suggestions = get_categories($args);
return($category_suggestions); return($category_suggestions);