I rarely comment on youtube. But thank you. I solved my problem that my server was filled with photos. Now i can clean. Have a nice day. And a nice summer. Thank you
Thank you very much. This is what we need and is very important. You were wonderful with this important addition that I needed and everyone who had a store needed. Thank you very much
Thanks for this, it works great!! However I do have one question... Is there a way to include any variable product specific images too in this? It only appears to delete the main image for me and not the additional images we use at the variable level
Blocksy and Kadence are currently two of the best WordPress themes. So, if you’re interested, then you can grab: 🔵 Kadence theme here: wpsimplehacks.com/kadence (SAVE 10% Coupon SIMPLEHACKS) 🅱️ Blocksy theme wpsimplehacks.com/blocksy (SAVE 10% Coupon WPSH10)
Is there a way to do this if the product is out of stock? We don't want to delete the product but we want to update the image once the new stock arrives because the product image will vary.
Loving your tutorials, thank you. I am looking for a solution, shortcode or similar, I want to display a section of the current products related categories or sub categories products. So if a party theme has 12 products, all those product need to appear on any of its single products page
I am adding the Snippett "Delete woocommerce product images after product deletion" the following error The code snippet you are trying to save produced a fatal error on line 1: syntax error, unexpected 'woocommerce' (T_STRING)
Hi!, Thanks for sharing this code , it works great deleting the image in media library but it doesn't delete the server files, they are stilll available on the server but not showing on media library. Can you help with any idea what could be missing?. Thanks
@@wpsimplehacks I just found out that the plugin WPML was letting the image on the server, when the product was deleted, it delete just for 1 language and left the image for other languages, I found a 'When deleting a post, delete translations as well' option and then works great. Thanks your your reply and code!
I tried to enter it in the functions php but then I got a critical error on my side. After this I tried to enter it via code snippet plugin but got this message: The snippet has been deactivated due to an error on line 4: Cannot redeclare function delete_product_images.
Just re-tested on my other site and works well. Did you delete the snippet from the functions.php before adding it to Code snippets? If not then delete it because you can use the function only in one place.
Thanks for sharing! It would be more awesome if you could share the adaptation of this snippet but for delete images for regular blog posts, as you know each image uploaded from every blog post, WP generate 4 to 8 thumbnails images that are slowly filling the server. Did you know a way to effectively delete all unused images from upload media folder as well erase ID images from database? Great channel CONGRATS! 👏👏👏🥳🥳🥳
I got this on instalation can you advise please Don't Panic The code snippet you are trying to save produced a fatal error on line 23: syntax error, unexpected end of file The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before. Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
Basically what you have shown in the video and what i got in the website both codes are different..and apparently it is not working on site .after deleting the product its still stay there in media library
1) How is this code shown in the video (screenshot cln.sh/7YAZIp) different than the code in my site here wpsimplehacks.com/how-to-automatically-delete-woocommerce-images/ 2) I just tested the code on my site, and it still works well
Thanks for this video. If you want to delete media directly you should add define('EMPTY_TRASH_DAYS', 0);. And if you only want to delete specific media you should delete them by ID 😉
I rarely comment on youtube. But thank you. I solved my problem that my server was filled with photos. Now i can clean. Have a nice day. And a nice summer. Thank you
Glad it helped
Thank you, thank you, thank you! You have saved me so much time. It works like a dream! 👏 And you have a new subscriber. All the best!
Glad it helped! 🙂
Thank you very much. This is what we need and is very important. You were wonderful with this important addition that I needed and everyone who had a store needed. Thank you very much
Glad it helped 🙂
Very useful but, if some images are used in more than one product (i.e. gallery images) this script delete or bypass?
It’s been a while since I made this video and used this code myself, so I’m not exactly sure. Can you test it and let me know?
Thanks for this, it works great!! However I do have one question... Is there a way to include any variable product specific images too in this? It only appears to delete the main image for me and not the additional images we use at the variable level
Not that I know of
Hello, thank you! I have one question, if I already deleted the product, it is possible to delete the images ?
Not with that snippet.
@@wpsimplehacks Thats what I thought, thank you!!
please suggest the best and fast theme according to google page speed analytics
Blocksy and Kadence are currently two of the best WordPress themes. So, if you’re interested, then you can grab:
🔵 Kadence theme here: wpsimplehacks.com/kadence (SAVE 10% Coupon SIMPLEHACKS)
🅱️ Blocksy theme wpsimplehacks.com/blocksy (SAVE 10% Coupon WPSH10)
which code did you paste, i am lost cos i didn't find any code.
There’s a link In the description of the video.
Is there a way to do this if the product is out of stock? We don't want to delete the product but we want to update the image once the new stock arrives because the product image will vary.
Sorry, can’t help with that
Does it work even if I don't want to delete the product but just the images associated to products?
It will delete images ONLY if you delete the product. So, if you want to delete only images then use Media library for it.
Hi I have activated the Code Snippetts plugin but it does not delete the images when I click delete permanately in trash products
I just re-tested it on my site and everything works as shown in the video.
AMAZING SNIPPET TRICK!!! 👏👏👏
😉
very helpful. you made my life easier. Love from Pakistan
Glad it helped
Can It delete review images on product pages (not just product images? Thanks
Not with that snippet. You have to find another solution, I don’t have any for it so far.
Loving your tutorials, thank you. I am looking for a solution, shortcode or similar, I want to display a section of the current products related categories or sub categories products. So if a party theme has 12 products, all those product need to appear on any of its single products page
See whether this plugin helps you out wordpress.org/plugins/custom-related-products-for-woocommerce/
@@wpsimplehacks thanks... Recall been enjoying your videos. Makes me realise how little I know. Thank you
I am adding the Snippett
"Delete woocommerce product images after product deletion"
the following error
The code snippet you are trying to save produced a fatal error on line 1:
syntax error, unexpected 'woocommerce' (T_STRING)
I just re-tested it on my site and everything works as shown in the video.
Hi!, Thanks for sharing this code , it works great deleting the image in media library but it doesn't delete the server files, they are stilll available on the server but not showing on media library. Can you help with any idea what could be missing?. Thanks
Hmm... Just tested on two on my sites and it is working well on those. Therefore, I don't know the issue may be.
@@wpsimplehacks I just found out that the plugin WPML was letting the image on the server, when the product was deleted, it delete just for 1 language and left the image for other languages, I found a 'When deleting a post, delete translations as well' option and then works great. Thanks your your reply and code!
Thank you for the follow-up
Best content you provide 💯💯
Appreciate that
Woooooooooooo Thank you!!!!! Love Youuuuuu !👏👏👏
🙂
How can i only delete varation images when variation is deleted? Could you please help me a lil here?
Sorry, I don’t know the answert to that question.
@@wpsimplehacks Oh, well thankyou for a quick reply.
I tried to enter it in the functions php but then I got a critical error on my side. After this I tried to enter it via code snippet plugin but got this message:
The snippet has been deactivated due to an error on line 4:
Cannot redeclare function delete_product_images.
Just re-tested on my other site and works well.
Did you delete the snippet from the functions.php before adding it to Code snippets? If not then delete it because you can use the function only in one place.
Hey how do I set the product to automatically delete after I sell the item ?
Sorry, I don’t have that kind of snippet
Thank you very much!!
You're welcome! 🙂
Thanks for sharing! It would be more awesome if you could share the adaptation of this snippet but for delete images for regular blog posts, as you know each image uploaded from every blog post, WP generate 4 to 8 thumbnails images that are slowly filling the server. Did you know a way to effectively delete all unused images from upload media folder as well erase ID images from database? Great channel CONGRATS! 👏👏👏🥳🥳🥳
Sorry, can't help with that
does anybody know how comes that in my environment images are not deleted from the server? of course the script works very good for media library
Sorry, can’t help with that.
Thank you
You're welcome
The snippet has been deactivated due to an error on line 5:
Cannot redeclare function delete_product_images.
I just tested it on my site and everything works well. See here cln.sh/UvUm0v
Otsisin seda juba ammu. Tänud!
Vaeh-vaeh, keda siin kanalil näha :) Tore, et aitas
How to delete only gallery images and exclude featured image?
Sorry, I don’t have this solution for you.
Kõlad nagu eestlane :D
AItäh!
Sa kõlad ka nagu eestlane :) Võta heaks.
I got this on instalation can you advise please
Don't Panic
The code snippet you are trying to save produced a fatal error on line 23:
syntax error, unexpected end of file
The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.
Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
This means that you did not copy the whole code. Pay attention that the code ends with three brackets }.
It seems that you did not copy the third one.
Bro both the codes are different..
What do you mean by that?
Basically what you have shown in the video and what i got in the website both codes are different..and apparently it is not working on site .after deleting the product its still stay there in media library
1) How is this code shown in the video (screenshot cln.sh/7YAZIp) different than the code in my site here wpsimplehacks.com/how-to-automatically-delete-woocommerce-images/
2) I just tested the code on my site, and it still works well
It is seems working brother .iam so sorry. Thank you ..
HELLO!!!
😉
code snippet seems to be hidden from mere mortals
Good call, Phil ;)
It’s here wpsimplehacks.com/how-to-automatically-delete-woocommerce-images/
@@wpsimplehacks thanks heaps!.... BTW your content is brilliant mate!
Thanks for this video. If you want to delete media directly you should add define('EMPTY_TRASH_DAYS', 0);. And if you only want to delete specific media you should delete them by ID 😉
Thanks for the tip :)