我所知的唯一备选方案(使用核心功能)是:
// Get terms whose name begins with "my_name"
get_terms( \'category\', array( \'name__like\' => \'my_name\' ) );
// Get terms whose name contains "my_name"
get_terms( \'category\', array( \'search\' => \'my_name\' ) );
如果需要精确匹配,则必须执行自定义查询。
$wpdb->get_results( "SELECT t.*, tt.* FROM $wpdb->terms AS t
INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id
WHERE tt.taxonomy = \'category\' AND t.name = \'my_name\'"
);