How to set default image link for broken images in Wordpress?
How to set default image link for broken images in Wordpress?
We have a lot of broken image links from remote server url addresses.
You can see on here (NSFW)
Example link of broken image: http://thumb-v.xhcdn.com/t/260/8_5249260.jpg
All of the broken images have different folders and numbers. Also different subdomains and domains.
http://thumb-v.xhcdn.com/t/260/8_5249260.jpg
Tried this code:
function nofind()
var img = event.srcElement
img.src="https://example.com/wp-content/uploads/2018/08/lockedpornvideo.jpg";
img.onerror = null;
var imgs = document.getElementsByTagName("img");
for (var i = 0; i < imgs.length; i++)
imgs[i].onError=nofind;
Added as javascript into header.php but no success.
We want to set a one default image for those all of the broken images.
How to do this?
can you show me an example ?
– maxwassim
Aug 21 at 16:25
"can you show me an example" Something like
<img src="video.jpg" onerror="this.onerror=null;this.src='defualt.jpg';"/>
or <img src="video.jpg" onerror="this.src='defualt.jpg'; return false;"/>
– Raymond Nijland
Aug 21 at 16:27
<img src="video.jpg" onerror="this.onerror=null;this.src='defualt.jpg';"/>
<img src="video.jpg" onerror="this.src='defualt.jpg'; return false;"/>
But there are 5 thousands of images exist. How can i bulk and auto apply this?
– maxwassim
Aug 21 at 16:30
"But there are 5 thousands of images exist. How can i bulk and auto apply this? " Edit your PHP code.
– Raymond Nijland
Aug 21 at 16:31
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
use javascript's onerror tag?
– Raymond Nijland
Aug 21 at 16:24