Timeline for Query all posts where a meta key does not exist
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 6, 2021 at 11:22 | comment | added | Andy Tschiersch | The 'OR' combination as showed above at 3) works for me too, but it is very inperformant and results in heavy load times over 30 seconds. (using Woocommerce with more than 9000 products) | |
S Jul 18, 2019 at 2:44 | history | edited | Howdy_McGee♦ | CC BY-SA 4.0 |
Clarifying that this code is no longer relevant these days (see comments)
|
S Jul 18, 2019 at 2:44 | history | suggested | Pikamander2 | CC BY-SA 4.0 |
Clarifying that this code is no longer relevant these days (see comments)
|
Jul 18, 2019 at 2:07 | review | Suggested edits | |||
S Jul 18, 2019 at 2:44 | |||||
Apr 29, 2017 at 19:56 | comment | added | jave.web | trex005 is right: "(Note: Due to bug #23268, value is required for NOT EXISTS comparisons to work correctly prior to 3.9. You must supply some string for the value parameter. An empty string or NULL will NOT work. However, any other string will do the trick and will NOT show up in your SQL when using NOT EXISTS. Need inspiration? How about 'bug #23268'.)" | |
Apr 15, 2016 at 7:42 | comment | added | trex005 |
The EXISTS and NOT EXISTS "bug" which required you to specify a value, was fixed in WP 3.9
|
|
Apr 8, 2016 at 3:12 | comment | added | Chizzle |
Be aware of an orderby meta_key that may also be in your query! Wordpress will hardcode WHERE meta_key = value for a meta orderby as well!
|
|
Jul 1, 2015 at 10:08 | comment | added | Igor Jerosimić | If I use compare EXISTS, value is unfortunately not ignored in newer versions of WP (tested in 4.2.2) | |
Jan 11, 2015 at 3:33 | vote | accept | JordanBel | ||
Mar 21, 2013 at 14:18 | comment | added | lorem monkey | Thanks for the great explanation and solution to trick WP :) Did take some time to get here - but now I want to click upvote for at least 10 times (if only I could ;)) | |
Mar 6, 2013 at 19:22 | comment | added | Taylor Dewey | Well written and confirmed that adding an empty value returns expected results. I'd say it's unintentional, may be worth a look at trac.wordpress.org to see if there's already a ticket, if not, this is reproducible. | |
Jan 17, 2013 at 1:49 | comment | added | JordanBel | Thanks! And sorry for the delay. I ended up using a query, but I will be testing your solution in the following hours so I can switch back and maybe if this work we can help some other. I will let you know as soon as I can check it. Thanks again | |
Jan 16, 2013 at 15:55 | history | edited | Tomas Buteler | CC BY-SA 3.0 |
Added information regarding the WP version which this answer applies to.
|
Jan 16, 2013 at 15:05 | history | answered | Tomas Buteler | CC BY-SA 3.0 |