Fallback to the category ID if category nicename is empty.

git-svn-id: https://develop.svn.wordpress.org/trunk@1482 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2004-07-24 03:39:21 +00:00
parent 68f755f608
commit 3fd4cd56fc
1 changed files with 3 additions and 2 deletions

View File

@ -47,7 +47,8 @@ case 'addcat':
die (__('Cheatin’ uh?'));
$cat_name= addslashes(stripslashes(stripslashes($_POST['cat_name'])));
$category_nicename = sanitize_title($cat_name);
$cat_ID = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories ORDER BY cat_ID DESC LIMIT 1") + 1;
$category_nicename = sanitize_title($cat_name, $cat_ID);
$category_description = addslashes(stripslashes(stripslashes($_POST['category_description'])));
$cat = intval($_POST['cat']);
@ -126,7 +127,7 @@ case 'editedcat':
$cat_name = $wpdb->escape(stripslashes($_POST['cat_name']));
$cat_ID = (int) $_POST['cat_ID'];
$category_nicename = sanitize_title($cat_name);
$category_nicename = sanitize_title($cat_name, $cat_ID);
$category_description = $wpdb->escape(stripslashes($_POST['category_description']));
$wpdb->query("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'");