[wp-trac] [WordPress Trac] #57041: Deprecate `get_page_by_title()` in favour of `WP_Query`

WordPress Trac noreply at wordpress.org
Wed Nov 9 05:00:40 UTC 2022


#57041: Deprecate `get_page_by_title()` in favour of `WP_Query`
-------------------------------+---------------------
 Reporter:  peterwilsoncc      |       Owner:  (none)
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  6.2
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+---------------------

Comment (by TimothyBlynJacobs):

 I agree this would be good to deprecate in 6.2. The `WP_Query` API is
 simple enough to use and has all of the configuration flags necessary.
 This way we can avoid duplicating numerous `WP_Query` args in the function
 call in order to accommodate all the different use cases.

 If a developer still wants to use a standalone function for this purpose,
 they can always write their own wrapper that calls `WP_Query` under the
 hood.

 Additionally, this function is not used in WordPress Core, and has been
 discouraged by many linting tools as it has been an uncached query
 previously.

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


More information about the wp-trac mailing list