[wp-trac] [WordPress Trac] #57039: WP 6.1 - get_page_by_title(null) returns a page

WordPress Trac noreply at wordpress.org
Tue Nov 8 19:05:55 UTC 2022


#57039: WP 6.1 - get_page_by_title(null) returns a page
-------------------------------+------------------------------
 Reporter:  stentibbing        |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  6.1
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------
Changes (by pbiron):

 * component:  General => Posts, Post Types


Comment:

 @stentibbing thank you for the ticket and welcome to Trac!!

 I can confirm that `get_page_by_title( null )` in 6.1 indeed returns a
 `WP_Post` and that it did not in WP 6.0.x.

 This bug was introduced in [54234].

 Related: 36905

 @spacedmonkey I think to easiest fix would be to check whether
 `$page_title` is empty because constructing the `WP_Query` and calling
 `_doing_it_wrong()` if it is and returning `null` in that case.
 Thoughts?

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


More information about the wp-trac mailing list