How to get value of a selected option from select tag and use it in WP_query to filter posts?

This is how I’m getting the value but how to use it in WP_Query so when I click Search to display let’s say posts with Option 1 value?

I’m doing this but don’t know if meta_value is the answer

$search_query=new Wp_Query($search_args);
$something=isset($_GET[‘something’])&&$_GET[‘something’]?$_GET[‘something’]:”;

if($something){
$search_args[‘meta_value’]=$something;
}

<select name=”something” id=”” class=””
style=”width: 100%;”>
<option value=”Something”>Something</option>
<option value=”Option 1″>Option 1</option>
<option value=”Option 2″>Option 2</option>
</select>

Read more here:: How to get value of a selected option from select tag and use it in WP_query to filter posts?

Leave a Reply

Your email address will not be published. Required fields are marked *