Ticket #11863: 11863.18.diff
File 11863.18.diff, 1.4 KB (added by , 9 years ago) |
---|
-
src/wp-includes/post.php
5340 5340 return; 5341 5341 } 5342 5342 5343 // Don't bother if the slug is being changed by untrashing a post. 5344 if ( '__trashed' === substr( $post_before->post_name, -9 ) ) { 5345 return; 5346 } 5347 5343 5348 // We're only concerned with published, non-hierarchical objects. 5344 5349 if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) { 5345 5350 return; -
tests/phpunit/tests/post/wpCheckForChangedSlugs.php
1 <?php 2 3 /** 4 * @group post 5 */ 6 class Tests_WPCheckForChangedSlugs extends WP_UnitTestCase { 7 8 /** 9 * @ticket 11863 10 */ 11 function test_untrashing_a_post_should_not_store_the_temporary_trashed_slug() { 12 $about_page_id = self::factory()->post->create( array( 13 'post_type' => 'page', 14 'post_title' => 'About', 15 'post_status' => 'publish' 16 ) ); 17 wp_trash_post( $about_page_id ); 18 19 wp_untrash_post( $about_page_id ); 20 21 $this->assertEquals( false, get_post_meta( $about_page_id, '_wp_old_slug', true ) ); 22 } 23 }