From 78c8d3f3f684efb1acd7f49f47e8faa1b73ebbb2 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Tue, 12 Jun 2007 20:49:40 +0000 Subject: [PATCH] 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 --- wp-includes/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index d123f8de85..e82d920aed 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -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);