wordpress $query->set by meta key value
<p>I am trying to modify all queries of a post type "products" to only show if the product/post has a certain meta_key of "wholesale_price" which the meta_value needs to be greater than 0.</p>

<p>Here is what i have:</p>

<pre><code>add_action( 'pre_get_posts', 'rc_modify_query_get_design_projects' );
function rc_modify_query_get_design_projects( $query ) {

    if($query-&gt;is_main_query() &amp;&amp; $query-&gt;query_vars['post_type'] == 'product' ) {

    $query-&gt;set('meta_key', 'wholesale_price');
    $query-&gt;set('meta_compare', '&gt;');
    $query-&gt;set('meta_value', '0');

}
</code></pre>

<p>}</p>

<p>For some reason this still returns everything. Is this the right way of doing things?</p>