Timeline for How do I use wp_query for WordPress search?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 14, 2012 at 17:05 | comment | added | kaiser |
I didn't downvote you, but I guess it's because there're much better approaches to this, like using the posts_clauses and such pre-query filters, which will save you some queries.
|
|
Jun 12, 2012 at 22:20 | comment | added | 3ph | Hi @moraleida, I just tried it but I'm not getting any results from custom fields in the search. Here's the code from my search.php file: pastie.org/private/jhgsmaolvjyswyhsfphlfa and here's the code from searchform.php: pastie.org/private/o3hrtqajh8hbkiht1nyoba | |
Jun 9, 2012 at 16:12 | comment | added | moraleida |
About the code usage, it depends on what really you need to achieve. Try it out with one custom field as is. If it works, then just add another 4 of the array('key' => 'field_to_seach', 'value' => $thesearch, 'compare' => 'IN') parts. Drop in if you need more help.
|
|
Jun 9, 2012 at 16:08 | comment | added | moraleida | I wasn't talking about you @3ph, not to worry :). | |
Jun 9, 2012 at 15:33 | comment | added | 3ph | Hi Moraleida, thanks for the answer. I'll surely try it out. I don't know who down-voted the answer, but I can't even vote because my reputation is low as a newbie here. I'll try out the code that you've suggested. My search form has 5 drop-down fields with values for those 5 custom fields. Should I just use the form as-is, with you code above? | |
Jun 9, 2012 at 13:26 | comment | added | moraleida | Someone down voted this and I'd really like to know why, since this is something I use on a regular basis. If you care to explain, I appreciate it. :) | |
Jun 8, 2012 at 20:42 | history | answered | moraleida | CC BY-SA 3.0 |