From f2d1e16f501f6b2ff9650f757e5c3bfab85aaff8 Mon Sep 17 00:00:00 2001 From: whyisjake Date: Thu, 23 Sep 2021 20:27:58 +0000 Subject: [PATCH] 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 --- wp-admin/includes/ms.php | 3 +++ wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index 7796745a2e..76af47f8af 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -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; diff --git a/wp-includes/version.php b/wp-includes/version.php index 25949db5b4..64f9af4bf2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.