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.

Built from https://develop.svn.wordpress.org/trunk@51855


git-svn-id: http://core.svn.wordpress.org/trunk@51454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake 2021-09-23 20:27:58 +00:00
parent 052b00b0c4
commit f2d1e16f50
2 changed files with 4 additions and 1 deletions

View File

@ -736,6 +736,9 @@ function avoid_blog_page_permalink_collision( $data, $postarr ) {
if ( ! is_main_site() ) {
return $data;
}
if ( isset( $data['post_parent'] ) && $data['post_parent'] ) {
return $data;
}
$post_name = $data['post_name'];
$c = 0;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51854';
$wp_version = '5.9-alpha-51855';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.