Skip to content

Instantly share code, notes, and snippets.

Avatar

Akramul Hasan akramulhasan

  • Dhaka, Bangladesh
View GitHub Profile
View Hide product from query which has no thumbnail
add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $query ) {
$query->set( 'meta_query', array( array(
'key' => '_thumbnail_id',
'value' => '0',
'compare' => '>'
)));
}
View Show Featured Image in Shop page