Timeline for Get all the posts where meta field with multiple choice has several values checked
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 23, 2015 at 1:11 | comment | added | pcarvalho | nice insight. in the case above, you could use %aa% to get xxaabb. you should write your own answer too below ;) | |
Apr 22, 2015 at 6:08 | comment | added | folibis |
Ok, after a bit of research I've found that WP loop does not get meta data in account while SQL query. It can be easy shown by echo $GLOBALS['wp_query']->request . As I understand WP receives all the query records without meta filtering (OMG!) and apply this filter in loop itself for each record. So I removed all meta filter from query_posts to do that by myself, in code with in_array .
|
|
Apr 22, 2015 at 2:31 | comment | added | folibis |
Now I noticed that it work not as I expected. for example if I have choices {"aa","bb","aacc"} and aa is criteria for searching so it returns also posts where only aacc was selected. In other words it works like a real LIKE but I need it works like in_array
|
|
Apr 21, 2015 at 15:19 | comment | added | pcarvalho | glad i could help! :D | |
Apr 21, 2015 at 4:19 | comment | added | folibis |
Thanks, @peteroak, that works! Probably I was baffled by the fact that LIKE is applies more to strings than to arrays.
|
|
Apr 21, 2015 at 4:16 | vote | accept | folibis | ||
Apr 21, 2015 at 3:02 | history | answered | pcarvalho | CC BY-SA 3.0 |