Use get_var and only select cat_ID. see #4040

git-svn-id: https://develop.svn.wordpress.org/trunk@5247 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
rob1n 2007-04-12 02:08:40 +00:00
parent f9ab937ce7
commit e8c058cfc1
1 changed files with 1 additions and 1 deletions

View File

@ -293,7 +293,7 @@ class WP_Import {
if (count($categories) > 0) { if (count($categories) > 0) {
$post_cats = array(); $post_cats = array();
foreach ($categories as $category) { 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 == 0) {
if ($cat_ID = wp_insert_category(array('cat_name' => $category))) { if ($cat_ID = wp_insert_category(array('cat_name' => $category))) {
$post_cats[] = $cat_ID; $post_cats[] = $cat_ID;