From 68f755f60852a3fc1ec7f9e6574cb6b302c4891f Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 24 Jul 2004 03:22:49 +0000 Subject: [PATCH] If the sanitized title is empty, fallback to the post ID for the nicename. http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000116 git-svn-id: https://develop.svn.wordpress.org/trunk@1481 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/post.php | 10 +++++----- wp-includes/functions-formatting.php | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/wp-admin/post.php b/wp-admin/post.php index a827bb8fe7..674b57132d 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -45,6 +45,8 @@ case 'post': $standalone = 1; require_once('admin-header.php'); + $post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1") + 1; + $post_pingback = intval($_POST['post_pingback']); $content = balanceTags($_POST['content']); $content = format_to_post($content); @@ -71,9 +73,9 @@ case 'post': $post_password = $_POST['post_password']; if (empty($post_name)) - $post_name = sanitize_title($post_title); + $post_name = sanitize_title($post_title, $post_ID); else - $post_name = sanitize_title($post_name); + $post_name = sanitize_title($post_name, $post_ID); $trackback = $_POST['trackback_url']; // Format trackbacks @@ -123,8 +125,6 @@ case 'post': $result = $wpdb->query($postquery); - $post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1"); - if (!empty($_POST['mode'])) { switch($_POST['mode']) { case 'bookmarklet': @@ -302,7 +302,7 @@ case 'editpost': if (empty($ping_status)) $ping_status = 'closed'; //if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status'); $post_password = $_POST['post_password']; - $post_name = sanitize_title($_POST['post_name']); + $post_name = sanitize_title($_POST['post_name'], $post_ID); if (empty($post_name)) $post_name = sanitize_title($post_title); $trackback = $_POST['trackback_url']; // Format trackbacks diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 2380b1c0a2..9b7e91681f 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -1,6 +1,6 @@