开发者 | room34 |
---|---|
更新时间 | 2024年4月24日 05:45 |
捐献地址: | 去捐款 |
PHP版本: | 4.9 及以上 |
WordPress版本: | 6.5 |
img
tags from the database.
That's it! There is no configuration necessary. The plugin adds a compact bit of JavaScript that detects if an image is returning a 404 error, and removes its HTML code from displaying on the page.
No, version 1 does not make any changes whatsoever to your database. It also does not remove the missing image file's URL from the HTML that is sent to the user's web browser; it removes the tags from the DOM (Document Object Model) after the page has been loaded, using JavaScript, to prevent "broken image" icons, extra white space, and links/captions associated with those missing images from displaying.
The r34rbi_missing_image
jQuery hook (added in version 1.4.0) allows you to modify the plugin's behavior with custom code, whenever a missing image is encountered. It is used by the r34rbi_redirect_on_missing_image
PHP filter (also added in version 1.4.0) to easily redirect to the home page in this situation, by adding this snippet of PHP code to your theme:
add_filter('r34rbi_redirect_on_missing_image', '__return_true');
You can replace '__return_true'
with a custom callback function to change the redirect URL to something other than your site's home page.
r34rbi_missing_image
jQuery hook to allow custom functionality to override the plugin's default behavior when a missing image is encountered. Also added r34rbi_redirect_on_missing_image
PHP filter, to allow for an easy application of this functionality in your theme. See FAQs for code example.img
tags inserted dynamically into the DOM via AJAX.script.min.js
file to reduce page payload.the_content
filter to insert onerror
into all img
tags.script.js
file; moved JavaScript logic from inline onerror
attribute to a function that will also remove parent a
element and ancestor .wp-caption
element from the DOM, in addition to the img
tag itself.