Timeline for Get posts by meta value
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 10, 2020 at 11:19 | comment | added | Erenor Paz |
You mean something like WHERE metatable1.meta_key = 'cp_annonceur' AND metatable1.meta_value = 'professionnel' AND metatable2.meta_key = 'cp_other_meta' AND metatable2.meta_value = 'other_value' ? (Note that i suppose we do a join on the same posts_meta table using two names metatable1 and metatable2 ). This can be achieved adding field meta_query (as an array) to the query. Take a look at: developer.wordpress.org/reference/classes/wp_query/… and go to paragraph "‘orderby’ with multiple ‘meta_key’s"
|
|
Apr 9, 2020 at 22:59 | comment | added | G-J | @ErenorPaz I understand what you are saying but this way would make it easy if you had multiple meta key/values as a criteria... Is there an official way to handle multiple criteria? | |
Mar 3, 2017 at 10:11 | comment | added | Erenor Paz | It might have better performances, but it throws away the whole idea of having Wordpress functions to search (and cache) data. And, also, what will happen if WP decides to change the table structure? :) | |
Jan 28, 2016 at 14:40 | history | answered | michalzuber | CC BY-SA 3.0 |