[wp-trac] [WordPress Trac] #56689: Use WP_Query in get_page_by_path

WordPress Trac noreply at wordpress.org
Tue Jan 31 23:01:26 UTC 2023


#56689: Use WP_Query in get_page_by_path
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
                                                 |  spacedmonkey
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.2
Component:  Query                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing has-patch has-unit-    |     Focuses:
  tests has-testing-info                         |  performance
-------------------------------------------------+-------------------------
Changes (by iandunn):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 There's code in the wild that calls `get_page_by_path()` in
 `pre_get_posts` callbacks. In that scenario it looks like this causes an
 infinite loop fatal error.

 For example, [https://github.com/WordPress/wporg-
 developer/blob/2a230399c48bd4cd989c7ac5b68c3767ed250ab1/source/wp-
 content/themes/wporg-developer-2023/inc/handbooks.php#L109
 handbooks.php:109] and
 [https://github.com/WordPress/wordpress.org/blob/94807f3fad26c2cf009bfd747d4d49b68139468c/wordpress.org/public_html
 /wp-content/plugins/handbook/inc/template-tags.php#L132 template-
 tags.php:132] on w.org.

 xref https://wordpress.slack.com/archives/C02QB8GMM/p1675204296499039

 Is there something Core should do to handle that situation gracefully?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56689#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list