Skip to content

Commit e7ef6ad

Browse files
Fix: Regex pattern matching to identify verbose rules need
1 parent 047ef80 commit e7ef6ad

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/wp-includes/class-wp-rewrite.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,11 +1938,13 @@ public function init() {
19381938
$this->use_trailing_slashes = str_ends_with( $this->permalink_structure, '/' );
19391939

19401940
// Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
1941-
if ( preg_match( '/^[^%]*%(?:postname|category|tag|author)%/', $this->permalink_structure ) ) {
1942-
$this->use_verbose_page_rules = true;
1943-
} else {
1944-
$this->use_verbose_page_rules = false;
1941+
$clean_structure = str_replace( '/' . $this->index, '', $this->permalink_structure );
1942+
1943+
if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) {
1944+
$clean_structure = preg_replace( '/^\/\w+/', '', $clean_structure, 1 );
19451945
}
1946+
1947+
$this->use_verbose_page_rules = (bool) preg_match( '#^/?%(?:postname|category|tag|author)%#', $clean_structure );
19461948
}
19471949

19481950
/**

0 commit comments

Comments
 (0)