Code Snippet to Stop Wordpress Creating Duplicate and Unused Images in your Database
HTML-код
- Опубликовано: 24 авг 2024
- Even after you set the Wordpress Media Settings to be 0 for many sizes, you may find that they are still be created in your Wordpress Database which can build over time for no good reason.
Code:
websquadron.co...
We love to create - share - respond - and deliver.
🧐 Learn with our Mastery Modules: websquadron.co...
🔗 All of our Important Links: websquadron.co...
😃 Join our Facebook Group: / 3309523509284305
😃 Get Code Snippets Pro: r.freemius.com...
😃 Get Elementor Pro: be.elementor.c...
😃 Boost your RUclips Analysis: www.tubebuddy....
👕 Get our Merchandise: websquadron.co...
🥹 Support us: paypal.me/Webs...
Hire us to work on your Website!
💌 info@websquadron.co.uk
👩💻 Visit websquadron.co.uk
I can only imagine how quickly this grows in an ecommerce website 😱. Thanks Imran!
Totally
Absolutely a jewel of a snippet. Useful for so many websites out there, especially the image heavy ones or big shops. Great job & video.
This video now supersedes this one as it addresses images that are already loaded into the database.
ruclips.net/video/XcZfKGBmJRA/видео.html
A fantastic tip Imran. As someone who already has over 1200 images which are growing weekly, I'll apply this over weekend.
This should be an option in base wordpress to be honest. Good info 👍
Very useful, thanks Imran 👍
This should be an option in WP imho, but thanks for a great tip. I have a multisite with 250 sites on it that this is going to prove VERY useful for.
Glad it was helpful!
i love this kind of content VERY VERY much
This video now supersedes this one as it addresses images that are already loaded into the database.
ruclips.net/video/XcZfKGBmJRA/видео.html
@@websquadron Of course, WordPress is already not the best performance CMS, so any tricks helps WordPress have better performance will be very good content.
by the way 2 2 or 3 days i have tried media cleaner be meo apps (i think) it was very good
golden
cheers Imran... really wish Wordpress wouldn't do this by default or at least give us an option to turn it off... can end up with a ton of crap in the database...
Totally agree
Would this delete these images too - or just prevent them from being loaded?
Won't delete but will stop it happening again.
It's a pain that it does it in the first place.
Imran, then there will be the "proper size" issue on pagespeed insight, don't you think?
Not always if you're methodical about what you remove.
Hello, thank you for nice tip. I have a problem to save snippet in Elementor custom code section. Button save just doesn't react. { Where Do You Want to Display Your Code?}. It's just a Elem. bug?
use a plugin like codesnippets as suggested by Imran in the video... you can also add it to your themes functions.php file... i know that elementor custom code can accept js and css... not to sure about php...
Add to Code Snippets as in the video. It's a much safer way to do it.
@@websquadron I don't know why instal other plugin, when in Elementor Pro exist already. So I added to functions on child theme and it works. Thanks for idea.
The Snippets doesnt work for me, i tried so many things but i still get duplicates
It works for me though.
Thanks! All done but then, uploading a new media, WP still create 3 new sized images: 100x100, 300x300, 600x600, so strange...
This video now supersedes this one as it addresses images that are already loaded into the database.
ruclips.net/video/XcZfKGBmJRA/видео.html
@@websquadron Do you have a video on after the code is inserted and it still makes duplicates? It still makes 2 duplicates here. x100 and x300. (They are checked off)
Aoa Imran is it possible to take some consultation ? It’s about calendly/elementor integration
Hi. Sure, we have 2 options - 30mins or 1hr.
websquadron.co.uk/services/
@@websquadron site seems down
@@siddiqtalks Just checked and it's all fine. Or you can email me on info@websquadron.co.uk
Aqesome, is there a way to remove the existing images that have being created , prior to applying the code ?
Manually but I’m going to clarify tomorrow with a better method
@Web Squadron I looked at media cleaner, but that can open a can of worms on an ecommerce site as it can break the site.
Would be great to have a plugin which scans your whole website and keeps only the images in use across responsive view.
I know you can restore using meoaps media cleaner, but in even a small ecommerce website with 1000 products, it can be time consuming and then a pain if ir breaks etc
@Web Squadron could you tag me if you have a better way please 😁👌💯🤙
@@dingadanga8653 yup I’m looking into an alternative way
It still makes different sizes images
Yup hold on - I will do a video to clarify this as some sizes will still be generated by WP
@@websquadron it also depends on the theme you use
this pluging seems to be working ThumbPress - Stop Generating Unnecessary Thumbnails
2869 images processed
19178 thumbnails removed
0 thumbnails regenerated
it shows al the sizes that will be generated, including the sizes your theme sets, you can just copy these sizes and add these to your snippet
@@erling5148 So one cannot use this generally on any theme? What is it that differs?