mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-15 22:30:25 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@33262 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -186,6 +186,28 @@ class Tests_Post_WpUniquePostSlug extends WP_UnitTestCase {
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 5305
|
||||
*/
|
||||
public function test_slugs_resulting_in_permalinks_that_resemble_year_archives_should_not_be_suffixed_for_already_published_posts() {
|
||||
global $wp_rewrite;
|
||||
$wp_rewrite->init();
|
||||
$wp_rewrite->set_permalink_structure( '/%postname%/' );
|
||||
$wp_rewrite->flush_rules();
|
||||
|
||||
$p = $this->factory->post->create( array(
|
||||
'post_type' => 'post',
|
||||
'post_name' => 'foo',
|
||||
'post_status' => 'publish',
|
||||
) );
|
||||
|
||||
$found = wp_unique_post_slug( '2015', $p, 'publish', 'post', 0 );
|
||||
$this->assertEquals( '2015-2', $found );
|
||||
|
||||
$wp_rewrite->set_permalink_structure( '' );
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 5305
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user