Skip to content

Instantly share code, notes, and snippets.

@hmowais
Created December 11, 2019 12:27
Show Gist options
  • Save hmowais/70b26d0e2daf5cc34774595679092ec4 to your computer and use it in GitHub Desktop.
Save hmowais/70b26d0e2daf5cc34774595679092ec4 to your computer and use it in GitHub Desktop.
Replace Woocommerce default image placeholder
<?php
/**
* Change the placeholder image
*/
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
$upload_dir = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
// replace with path to your image
$src = $uploads . '/2012/07/thumb1.jpg';
return $src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment