if you want to check meta_key
exists or not in WP ?
This Is any WordPress function to check meta_key :
1 2 3 4 5 6 |
$post = 'post'; // your post, user or custom post name $id = '781'; //your post id $key = 'view'; // metakey name if (!metadata_exists('$post', $id, $key)) { // this condition if meta key exist. |
Ref : https://developer.wordpress.org/reference/functions/metadata_exists/