Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davemac/73be52df0a428d28cfa29afe69d783ed to your computer and use it in GitHub Desktop.
Save davemac/73be52df0a428d28cfa29afe69d783ed to your computer and use it in GitHub Desktop.
WooCommerce don't show current product in WC products sidebar widget
// don't show current product in products sidebar widget
function dmc_filter_woocommerce_products_widget_query_args( $query_args ) {
$dmc_product_id = get_the_ID();
$dmc_exclude_ids = array( $dmc_product_id );
$query_args['post__not_in'] = $dmc_exclude_ids;
return $query_args;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment