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:
parent
f9ab937ce7
commit
e8c058cfc1
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user