[wp-trac] [WordPress Trac] #51365: This is my very first suggestion. I hope I'm in the right place?
WordPress Trac
noreply at wordpress.org
Sun Sep 20 21:12:10 UTC 2020
#51365: This is my very first suggestion. I hope I'm in the right place?
--------------------------------------+-----------------------------
Reporter: DaveyJake | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version:
Severity: normal | Keywords:
Focuses: administration, template |
--------------------------------------+-----------------------------
Just wanted to suggest a simple function that checks for pre-existing
metadata for the native `post` post type.
Looking forward to getting more involved and collaborating with everyone!
{{{#!php
<?php
/**
* Check if post has pre-existing metadata.
*
* @since 5.5.2
*
* @see metadata_exists()
*
* @param int $post_id The post ID.
* @param string $meta_key The meta key to look for.
*
* @return bool True if key is found. False if not.
*/
function post_meta_exists( $post_id, $meta_key ) {
if ( metadata_exists( 'post', $post_id, $meta_key ) ) {
return true;
}
return false;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51365>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list