How to search for listings by multiple values from search bar
-
Hy, I have a search bar at inventory page which is filtering posts based on their title for now.
The listings also have a value of stock number set.
So, what I want is that I want the user to be able to search listings either by entering the listing title or listing stock number.
I’m not able to figure out what should be the meta query for it because the logic will be in inventory search bar only.
/* Search Text */ if(isset($_REQUEST['inventory_search']) && !empty($_REQUEST['inventory_search'])){ $inventory_search = $_REQUEST['inventory_search'][0]; $args['s'] = $inventory_search; $data = array( 'post_title' => $inventory_search, 's' => $inventory_search, 'compare' => 'LIKE', ); array_push($args, $data); }
this is the code I’m using right now to search by title. Any idea how can I make it to search by stock number as well?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to search for listings by multiple values from search bar’ is closed to new replies.