mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 01:24:27 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@37165 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -15,7 +15,21 @@ class Tests_WPInsertPost extends WP_UnitTestCase {
|
||||
'post_status' => 'publish'
|
||||
) );
|
||||
wp_trash_post( $trashed_about_page_id );
|
||||
$this->assertEquals( 'about-%trashed%', get_post( $trashed_about_page_id )->post_name );
|
||||
$this->assertEquals( 'about__trashed', get_post( $trashed_about_page_id )->post_name );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 11863
|
||||
*/
|
||||
public function test_trashed_suffix_should_be_added_to_post_with__trashed_in_slug() {
|
||||
$trashed_about_page_id = self::factory()->post->create( array(
|
||||
'post_type' => 'page',
|
||||
'post_title' => 'About',
|
||||
'post_status' => 'publish',
|
||||
'post_name' => 'foo__trashed__foo',
|
||||
) );
|
||||
wp_trash_post( $trashed_about_page_id );
|
||||
$this->assertEquals( 'foo__trashed__foo__trashed', get_post( $trashed_about_page_id )->post_name );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +63,7 @@ class Tests_WPInsertPost extends WP_UnitTestCase {
|
||||
'post_status' => 'publish'
|
||||
) );
|
||||
|
||||
$this->assertEquals( 'about-%trashed%', get_post( $trashed_about_page_id )->post_name );
|
||||
$this->assertEquals( 'about__trashed', get_post( $trashed_about_page_id )->post_name );
|
||||
$this->assertEquals( 'about', get_post( $about_page_id )->post_name );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user