Make WordPress Core

Opened 7 years ago

Closed 3 years ago

#44112 closed defect (bug) (duplicate)

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

Reported by: tubys's profile tubys Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: needs-patch needs-unit-tests
Focuses: multisite Cc:

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 (4)

#1 @jeremyfelt
6 years ago

#45260 was marked as a duplicate.

#2 @jeremyfelt
6 years 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.

#3 @terriann
3 years ago

This ticket looks like a duplicate of #51147 which has a patch with unit tests.

#4 @whyisjake
3 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Closing in favor of the work that has been done over on #51147.

Note: See TracTickets for help on using tickets.