From 3fd4cd56fc45e90bb6cdc70bd0c2803c3b99e293 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 24 Jul 2004 03:39:21 +0000 Subject: [PATCH] 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 --- wp-admin/categories.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 3ce0e5dff0..799e93322f 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -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'");