From 28ce0320e37804d600f8d9b562a962122cbb739d Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 14 Jul 2015 12:28:48 +0000 Subject: [PATCH] In `wp_unique_post_slug()`, only prevent date archive conflicts when the slug is being changed. This prevents existing posts with numeric slugs from having their permalinks changed on update. Fixes #5305. Built from https://develop.svn.wordpress.org/trunk@33262 git-svn-id: http://core.svn.wordpress.org/trunk@33234 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 5 +++-- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 04d624af2f..031595360e 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3816,9 +3816,10 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); - // Prevent post slugs that could result in URLs that conflict with date archives. + // Prevent new post slugs that could result in URLs that conflict with date archives. + $post = get_post( $post_ID ); $conflicts_with_date_archive = false; - if ( 'post' === $post_type && preg_match( '/^[0-9]+$/', $slug ) && $slug_num = intval( $slug ) ) { + if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) && $slug_num = intval( $slug ) ) { $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); $postname_index = array_search( '%postname%', $permastructs ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 0f39497aa8..8568a01166 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-beta2-33261'; +$wp_version = '4.3-beta2-33262'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.