for a simple meta query you can do this:
function wpa_47150( &$query ) {
if(!is_admin()){
set_query_var('meta_key', 'test_field');
set_query_var('meta_value','bacon');
}
}
add_action('pre_get_posts','wpa_47150');
i wasn’t sure it was going to work, but apparently you can set the whole meta_query object this way too
function wpa_47150( &$query ) {
if(!is_admin() && is_post_type_archive( 'test_post_type' )){
$metaq = ( array ( array(
'key' => 'test_field',
'value' => array( 10, 50 ),
'type' => 'numeric',
'compare' => 'BETWEEN'
))
);
set_query_var('meta_query', $metaq );
}
}
add_action('pre_get_posts','wpa_47150');
need to adjust the conditionals to your specific case