Skip to content

Instantly share code, notes, and snippets.

@ravishakya
Created September 4, 2016 07:35
Show Gist options
  • Save ravishakya/332b37887f96e7c48e00b338fae5f0f4 to your computer and use it in GitHub Desktop.
Save ravishakya/332b37887f96e7c48e00b338fae5f0f4 to your computer and use it in GitHub Desktop.
<?php
add_action( 'woocommerce_product_query', 'so_27971630_product_query' );
function so_27971630_product_query( $q ){
$meta_query = $q->get( 'meta_query' );
$meta_query[] = array(
'key' => 'custom_acf_key',
'value' => 'custom_acf_value',
'compare' => '='
);
$q->set( 'meta_query', $meta_query );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment