diff --git src/wp-includes/post.php src/wp-includes/post.php
index 98aeef5..ccb11de 100644
|
|
function wp_add_trashed_suffix_to_post_name_for_post( $post ) { |
6126 | 6126 | |
6127 | 6127 | $post = get_post( $post ); |
6128 | 6128 | |
6129 | | if ( strpos( $post->post_name, '-%trashed%' ) ) { |
| 6129 | if ( '__trashed' === substr( $post->post_name, -9 ) ) { |
6130 | 6130 | return $post->post_name; |
6131 | 6131 | } |
6132 | 6132 | add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name ); |
6133 | | $post_name = _truncate_post_slug( $post->post_name, 190 ) . '-%trashed%'; |
| 6133 | $post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed'; |
6134 | 6134 | $wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) ); |
6135 | 6135 | clean_post_cache( $post->ID ); |
6136 | 6136 | return $post_name; |
diff --git tests/phpunit/tests/post/wpInsertPost.php tests/phpunit/tests/post/wpInsertPost.php
index deb9570..f0e150a 100644
|
|
class Tests_WPInsertPost extends WP_UnitTestCase { |
15 | 15 | 'post_status' => 'publish' |
16 | 16 | ) ); |
17 | 17 | wp_trash_post( $trashed_about_page_id ); |
18 | | $this->assertEquals( 'about-%trashed%', get_post( $trashed_about_page_id )->post_name ); |
| 18 | $this->assertEquals( 'about__trashed', get_post( $trashed_about_page_id )->post_name ); |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * @ticket 11863 |
| 23 | */ |
| 24 | public function test_trashed_suffix_should_be_added_to_post_with__trashed_in_slug() { |
| 25 | $trashed_about_page_id = self::factory()->post->create( array( |
| 26 | 'post_type' => 'page', |
| 27 | 'post_title' => 'About', |
| 28 | 'post_status' => 'publish', |
| 29 | 'post_name' => 'foo__trashed__foo', |
| 30 | ) ); |
| 31 | wp_trash_post( $trashed_about_page_id ); |
| 32 | $this->assertEquals( 'foo__trashed__foo__trashed', get_post( $trashed_about_page_id )->post_name ); |
19 | 33 | } |
20 | 34 | |
21 | 35 | /** |
… |
… |
class Tests_WPInsertPost extends WP_UnitTestCase { |
49 | 63 | 'post_status' => 'publish' |
50 | 64 | ) ); |
51 | 65 | |
52 | | $this->assertEquals( 'about-%trashed%', get_post( $trashed_about_page_id )->post_name ); |
| 66 | $this->assertEquals( 'about__trashed', get_post( $trashed_about_page_id )->post_name ); |
53 | 67 | $this->assertEquals( 'about', get_post( $about_page_id )->post_name ); |
54 | 68 | } |
55 | 69 | |