I want to check if post meta key exists or not, out side of the loop. Is there any WordPress function to check if post meta key exist or not in WordPress database. I have to check this outside the loop. Any help will be highly appreciated.
In case anyone else stumbles across this old question like I just did, it looks like the best way to handle this is using metadata_exists()
see https://developer.wordpress.org/reference/functions/metadata_exists/
Here’s what the syntax would be for post meta:
metadata_exists('post', $post_id, 'meta_key_to_check');