mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 18:32:23 +01:00
Fallback to the category ID if category nicename is empty.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8633ffdba4
commit
2a146b7b5d
@ -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'");
|
||||
|
Loading…
Reference in New Issue
Block a user