Use get_var and only select cat_ID. see #4040

git-svn-id: http://svn.automattic.com/wordpress/trunk@5247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rob1n 2007-04-12 02:08:40 +00:00
parent f603da47b6
commit f8fd7370fc
1 changed files with 1 additions and 1 deletions

View File

@ -293,7 +293,7 @@ class WP_Import {
if (count($categories) > 0) {
$post_cats = array();
foreach ($categories as $category) {
$cat_ID = (int) $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE cat_name = '$category'");
$cat_ID = (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name = '$category'");
if ($cat_ID == 0) {
if ($cat_ID = wp_insert_category(array('cat_name' => $category))) {
$post_cats[] = $cat_ID;