Display posts which lack a certain custom value
-
I am trying to produce a page that gives me a list of posts which haven’t yet had a certain custom value entered. I am using this page as I guide, but can’t seem to manage it. I can produce a list of post that DO have a value entered using:
AND wpostmeta.meta_key = ‘custom_key’
AND wpostmeta.meta_value > ”or even removing that second line completely. However I cannot get it to work in reverse. I have tried at least twenty variations of NOT and ! in various places and calling for either ” or NULL, but nothing does the trick.
I think the problem lies in the fact that I am trying to retrieve posts where the ‘custom_key’ hasn’t yet been defined. If I define the custom key as blank, I can manage to pull a list of the posts where the value is blank, but this isn’t what I want. I want the posts where I haven’t done anything yet.
I sense that the solution lies in calling all the posts where a value has been entered, and then saying ‘every other post’. Unfortunately I don’t know how to do this. Any ideas?
Cheers
The topic ‘Display posts which lack a certain custom value’ is closed to new replies.