Make WordPress Core

Changeset 51855


Ignore:
Timestamp:
09/23/2021 08:26:28 PM (3 years ago)
Author:
whyisjake
Message:

Posts, Post Types: Don't add a trailing number when there is a unique post parent.

WordPress tries to avoid an issue where slugs might match an existing slug of a page/post.
If we are in a hierarchical post type, there will be a level, and we can leave it the same.

Props stormrockwell, SergeyBiryukov, terriann, tubys, jeremyfelt, Daschmi, MaximeCulea, knutsp, whyisjake.
Fixes #51147.
See also #44112 and #45260.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ms.php

    r50407 r51855  
    737737        return $data;
    738738    }
     739    if ( isset( $data['post_parent'] ) && $data['post_parent'] ) {
     740        return $data;
     741    }
    739742
    740743    $post_name = $data['post_name'];
Note: See TracChangeset for help on using the changeset viewer.