[wp-trac] [WordPress Trac] #58536: url_to_postid does not work at MS install in context of another blog when $wp_rewrite->use_verbose_page_rules differs

WordPress Trac noreply at wordpress.org
Wed Jun 14 11:18:44 UTC 2023


#58536: url_to_postid does not work at MS install in context of another blog when
$wp_rewrite->use_verbose_page_rules differs
--------------------------+-----------------------------
 Reporter:  david.binda   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In a multisite installation, where there are blogs with mixed permastruct
 of some have the `$wp_rewrite->use_verbose_page_rules` set to `true` and
 some to `false`, the `url_to_postid` fails to find a post, since it's
 queried as a page, [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/rewrite.php?rev=54364#L609 due to a falsey check].

 As the rewrites rules are untouched upon `switch_to_blog` action and as
 the `url_to_postid` function works directly with the `rewrite_rules`
 option ([https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/rewrite.php?rev=54364#L563 via `WP_Rewrite::wp_rewrite_rules()`
 function] ), IMHO the best way to fix such a case would be to not rely on
 the property, but perform the same check as when the
 `use_verbose_page_rules` property is being set (see the attached patch).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58536>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list