Created
November 16, 2018 07:55
-
-
Save simongcc/d445ab4854e3ab6738021b3cc63dab7f to your computer and use it in GitHub Desktop.
Change Woocommerce placeholder image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reference: https://docs.woocommerce.com/document/change-the-placeholder-image/ | |
/** | |
* Change the placeholder image | |
*/ | |
function custom_woocommerce_placeholder_img_src( $src ) { | |
$upload_dir = wp_upload_dir(); | |
$uploads = untrailingslashit( $upload_dir['baseurl'] ); | |
$src = $uploads . '/assets/images/placeholder.png'; | |
return $src; | |
} | |
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment