From cfab9716e34e7577776b183de1b2522c5127c8f3 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 7 Apr 2016 19:22:28 +0000 Subject: [PATCH] Use `__trashed` suffix rather than `-%trashed%` for trashed post slugs. Percent signs are reserved characters in URIs. As such, it was impossible for plugins to route requests to trashed posts, as happens in bbPress. The new `__trashed` suffix should be sufficiently unique. Also adds a test that demonstrates that the `__trashed` suffix can be appended to slugs that contain the suffix somewhere other than the end of the string. Props netweb, ericlewis. Fixes #11863. Built from https://develop.svn.wordpress.org/trunk@37165 git-svn-id: http://core.svn.wordpress.org/trunk@37132 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 98aeef597f..ccb11de728 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -6126,11 +6126,11 @@ function wp_add_trashed_suffix_to_post_name_for_post( $post ) { $post = get_post( $post ); - if ( strpos( $post->post_name, '-%trashed%' ) ) { + if ( '__trashed' === substr( $post->post_name, -9 ) ) { return $post->post_name; } add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name ); - $post_name = _truncate_post_slug( $post->post_name, 190 ) . '-%trashed%'; + $post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed'; $wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); return $post_name; diff --git a/wp-includes/version.php b/wp-includes/version.php index 2ec7d5a291..becb457924 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-RC1-37164'; +$wp_version = '4.5-RC1-37165'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.