WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 5 months ago

#44112 new defect (bug)

WP is changing page URL to avoid duplicate URL for non needed case

Reported by: tubys Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: needs-patch needs-unit-tests
Focuses: multisite Cc:
PR Number:

Description

WP has URL slug validator after page/post saved, when WP recognize potential of duplicate URL slug between the main site pages and each of existing multisites URL, WP will update the post_name (page slug URL) and adding suffix number to the page URL.

In the following scenario this validation should not be made:

  • Create New WP multi-site instance (sub-directory).
  • Create new site called ‘blog’ and publish it.
  • Move to root site.
  • Create new page without parent page with name ‘blog’ and publish it.
    • WP will change the page slug to ‘blog3’ (with number suffix) to avoid duplicate URL [OK]
  • Create new page with parent page ‘simple-page’ called ‘blog’ and publish it.
    • WP will change the site slug to ‘blog4’ [BUG]

In this case WP should leave the slug as is, because the result URL will be “simple-page/blog” and there is no URL conflict here.

Possible Solution:

update “avoid_blog_page_permalink_collision” function [wp-admin/includes/ms.php:640] to do not modify the “post_name” if “post_parent” exists.

Change History (2)

#1 @jeremyfelt
5 months ago

#45260 was marked as a duplicate.

#2 @jeremyfelt
5 months ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.9.5 to 3.0

Hi @tubys, thanks for the ticket and welcome to Trac.

I've closed #45260 as a duplicate of this ticket, but there is some discussion there that could be useful for folks.

It would be interesting to see if we can resolve this in the right way. It may be as straight forward as skipping anything with a non-empty post_parent, but we'll want to make sure tests account for the right scenarios.

Note: See TracTickets for help on using tickets.