[wp-trac] [WordPress Trac] #51787: Introduce dedicated function that retrieves post object by metadata

WordPress Trac noreply at wordpress.org
Wed Jul 16 15:52:48 UTC 2025


#51787: Introduce dedicated function that retrieves post object by metadata
-------------------------------+------------------------------
 Reporter:  DaveyJake          |       Owner:  (none)
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  5.5.3
 Severity:  normal             |  Resolution:
 Keywords:  dev-feedback       |     Focuses:
-------------------------------+------------------------------

Comment (by knutsp):

 A good idea, if this would be useful for core. If not, easy to implement
 in userland.

 And if it was to be added, I would suggest adding `$meta_compare = '='` to
 the signature.

 And being a bit smart, like including those posts where the meta_key "NOT
 EXISTS" in case the meta_value is empty. At least that is something I have
 implemented myself, and saves me setting up a complex meta query with
 relation "OR".

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


More information about the wp-trac mailing list