I’m not quite sure this is what you want (because it is so … easy), but all you need to do is add the following inputs to your search form:
<input type="hidden" id="meta_key" name="meta_key" value="YOUR-META-KEY">
<input type="hidden" id="meta_value" name="meta_value" value="YOUR-META-VALUE">
Or, if you want to trigger the search by hand, do it like so:
$search = new WP_Query(array(
's' => 'YOUR-KEYWORD(S)',
'meta_key' => 'YOUR-META-KEY',
'meta_value' => 'YOUR-META-VALUE'
));
// EDIT
If you’re dealing with a more complex setup, you might want to use a meta_query
:
$search = new WP_Query(array(
's' => 'YOUR-KEYWORD(S)',
'meta_query' => array(
'key' => 'YOUR-META-KEY',
'value' => 'YOUR-META-VALUE'
)
));
Or even
$search = new WP_Query(array(
's' => 'YOUR-KEYWORD(S)',
'meta_query' => array(
array(
'key' => 'YOUR-FIRST-META-KEY',
'value' => 'YOUR-FIRST-META-VALUE'
),
array(
'key' => 'YOUR-SECOND-META-KEY',
'value' => 'YOUR-SECOND-META-VALUE'
)
)
));