How to check if post meta key exists or not in wordpress database
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’);