Make sure post titles longer than 200 chars get unique slugs. fixes #4433. props AaronCampbell.

git-svn-id: https://develop.svn.wordpress.org/trunk@5685 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2007-06-12 20:49:40 +00:00
parent 18f29da681
commit 78c8d3f3f6
1 changed files with 1 additions and 1 deletions

View File

@ -606,7 +606,7 @@ function wp_insert_post($postarr = array()) {
if ($post_name_check || in_array($post_name, $wp_rewrite->feeds) ) {
$suffix = 2;
do {
$alt_post_name = $post_name . "-$suffix";
$alt_post_name = substr($post_name, 0, 200-(strlen($suffix)+1)). "-$suffix";
$post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1");
$suffix++;
} while ($post_name_check);