Add a post metadata if only the key and value does not exist

Question

In a WordPress post, these multiple values exist for a custom metadata with the key “client”

client=>Andy
client=>Johny
client=>April

I want to add a new metadata only if its value does not exist,

Result wanted:
client=>Andy will not be added because it already exists.

client=>Susan will be added because it does not exist
The post will now have these metadata values

client=>Andy
client=>Johny
client=>April
client=>Susan
0
Calvin 4 months 0 Answers 20 views 0

Leave an answer