[wp-trac] [WordPress Trac] #51365: Introduce dedicated function to check if post meta exists
WordPress Trac
noreply at wordpress.org
Wed Jul 16 15:19:55 UTC 2025
#51365: Introduce dedicated function to check if post meta exists
--------------------------------+------------------------------
Reporter: DaveyJake | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version:
Severity: normal | Resolution:
Keywords: dev-feedback close | Focuses:
--------------------------------+------------------------------
Changes (by callumbw95):
* keywords: dev-feedback => dev-feedback close
Comment:
Hi @DaveyJake,
I have taken a look into this, and I am not sure there is much need for
this wrapper function within core. My reasoning is that your function can
be condensed down to the following:
{{{#!php
<?php
function post_meta_exists( $post_id, $meta_key ) {
return metadata_exists( 'post', $post_id, $meta_key );
}
}}}
From the above code it raises the question why not just use
`metadata_exists()`?
As I am not sure the reason to add this wrapper function in to core, I am
going to mark this ticket with the `close` tag. However, please feel free
to reopen this ticket if you wish to continue this ticket further. 😃
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51365#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list