- This topic has 2 replies, 2 voices, and was last updated 7 years, 4 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Post Meta Key – If Key = empty or null?
Tagged: meta key
Hey there,
I have a form that searches for a post meta key through a drop-down. If key value = true then these posts will be displayed. Easy enough and works perfect.
But, if I want to say that this specific key has a value of null or that it doesn’t exist in the post, then is this possible?
I tried doing it with a value of null but it made no posts show up.
It can’t be done, at least not that way. This is not an uncommonly asked question, to which I have not seen an answer that works. The logic is OK, but WordPress doesn’t store data in this way. If a meta key has no data for a given post, there is no entry at all in the database for it, so there is nothing to check to see if it is empty.
This is quite common practice in related tables coding, to save space.