mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-11 02:49:04 +01:00
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:
parent
f603da47b6
commit
f8fd7370fc
@ -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…
Reference in New Issue
Block a user