Make WordPress Core


Ignore:
Timestamp:
07/14/2015 12:27:11 PM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/wpUniquePostSlug.php

    r32647 r33262  
    190190     * @ticket 5305
    191191     */
     192    public function test_slugs_resulting_in_permalinks_that_resemble_year_archives_should_not_be_suffixed_for_already_published_posts() {
     193        global $wp_rewrite;
     194        $wp_rewrite->init();
     195        $wp_rewrite->set_permalink_structure( '/%postname%/' );
     196        $wp_rewrite->flush_rules();
     197
     198        $p = $this->factory->post->create( array(
     199            'post_type' => 'post',
     200            'post_name' => 'foo',
     201            'post_status' => 'publish',
     202        ) );
     203
     204        $found = wp_unique_post_slug( '2015', $p, 'publish', 'post', 0 );
     205        $this->assertEquals( '2015-2', $found );
     206
     207        $wp_rewrite->set_permalink_structure( '' );
     208        flush_rewrite_rules();
     209    }
     210
     211    /**
     212     * @ticket 5305
     213     */
    192214    public function test_yearlike_slugs_should_not_be_suffixed_if_permalink_structure_does_not_result_in_a_clash_with_year_archives() {
    193215        global $wp_rewrite;
Note: See TracChangeset for help on using the changeset viewer.