Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#45260 closed defect (bug) (duplicate)

post_name collision in multiblog with sub pages

Reported by: daschmi's profile Daschmi Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.8
Component: Posts, Post Types Keywords:
Focuses: multisite Cc:

Description (last modified by SergeyBiryukov)

Wordpress Version: Version 4.9.8
Multiblog installation with several Blogs on one domain

Problem

On the root Blog i can not create a page with the page name "blog1" on a subpage.

Example URL: https://blogoverview/blog1

The problem is the funtion avoid_blog_page_permalink_collision in /wp-admin/includes/ms.php:640

workaround for me after the is_main_site() check:

if ($data['post_parent'] > 0) return $data;

Change History (6)

#1 @SergeyBiryukov
6 years ago

  • Component changed from Networks and Sites to Posts, Post Types
  • Description modified (diff)

#2 @knutsp
6 years ago

Hello @Daschmi and welcome to Trac.

Am I correct to assume your example link should be https://daschmi.de/blogoverview/blog1?

Then, in other words: On a subdirectory based Multisite with blog1 as one of the sub-sites paths, not only, and correctly, a page with name blog1 cannot be created, but not even as a subpage of a page.

If to be allowed, a check must be made when such page is moved to the top.

#3 @Daschmi
6 years ago

Yes you are right. The url should be https://daschmi.de/blogoverview/blog1

The function avoid_blog_page_permalink_collision should call after move and correct the url if necessary. If the page is on root level, the function works perfekt.

#4 @MaximeCulea
6 years ago

Welcome @Daschmi :)

I assume this is pretty logic to not allow on the root site a page called as a sub folder site.
The collision is made by the fact that rewrites couldn't get if it's a page on main blog or the front-page of a subdirectory blog.

The subtility here is because you seems using domain mapping to map https://blogoverview with https://daschmi.de. So this kind of check should be implemented by your mapping solution or wondering if we could do it in core ?

#5 @Daschmi
6 years ago

Thank you for your answer. I dont use domain mapping. In the root Blog there is a page with post_name "blogoverview". And a subpage of blogoverview with requested post_name "blog1". And additionally there is a blog with name "blog1" and the function correctly dont allow "blog1" as page name. But under "blogoverview" there are no url conflict.

The function has allowed "blogoverview", because there is no blog with name "blogoverview". But it also blocked the post_name "blog1", also as a page under blogoverview.

#6 @jeremyfelt
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

As a temporary solution, you could remove_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision' );, but it would be interesting to try and fix this in core as well.

I'm going to close this as a duplicate of #44112.

Note: See TracTickets for help on using tickets.