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

WordPress Trac noreply at wordpress.org
Sat Feb 4 23:35:51 UTC 2023


#56689: Use WP_Query in get_page_by_path
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
                                                 |  spacedmonkey
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:
Component:  Query                                |     Version:  trunk
 Severity:  normal                               |  Resolution:  wontfix
 Keywords:  needs-testing has-patch has-unit-    |     Focuses:
  tests has-testing-info 2nd-opinion             |  performance
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:15 iandunn]:
 > Here's a few other potential solutions:
 >
 > * Solve the performance issue without `WP_Query`, like by manually add
 caching to `get_page_by_path`. Add a comment explaining why it can't use
 `WP_Query`.
 > * Keep the `WP_Query` in most cases, but fallback to the old direct
 queries when a potential infinite loop is detected.

 Played with the latter idea too in [attachment:"56689.2.diff"], just to
 see what the patch would look like.

 Not exactly ideal, but seems better than manipulating the `$wp_filter`
 global :)

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


More information about the wp-trac mailing list