Lazy Loader


Lazy-Loading-Plugin das Bilder, iFrames, video- und audio-Elemente unterstützt und das schlanke lazysizes-Skript nutzt. Mit manuellen Anpassungen des Markups können auch Hintergrundbilder, Skripte und Stylesheets nachgeladen werden.

Unterstützt automatisches Lazy Loading für:

  • Images inserted via img or picture in posts, pages, Custom Post Types, Text Widgets, …
  • Beitragsbilder.
  • Inline background images.
  • Or all images and other enabled media in the markup (that is not excluded or already has a lazy loading attribute), via the option to process the complete markup.
  • iFrames.*
  • video-Elemente.*
  • audio-Elemente.*

* Kann in den Plugin-Optionen aktiviert werden.

Das Plugin kommt mit den folgenden Optionen (unter Einstellungen › Medien › Lazy-Loader-Optionen):

  • Do not lazy load elements with specific CSS classes (you can use the class skip-lazy by default).
  • Add filters that should be processed by Lazy Loader.
  • Lazy Loading für iFrames aktivieren.
  • Include the lazysizes native loading plugin that modifies images and iFrames to use the native lazy loading feature of browsers that already support it.
  • Include the lazysizes unveilhooks plugin that adds support for more elements, for example, video and audio elements.*
  • Lazy Loading für das Vorschaubild von video-Elementen aktivieren.
  • Lazy Loading für audio-Elemente aktivieren.
  • Enable lazy loading for inline background images.
  • Include lazysizes aspectratio plugin. This plugin calculates the needed space for images before they are loaded. That avoids content jumping when the images are loaded and makes the lazy loading work with masonry grids.
  • Display a loading spinner.
  • Disable the plugin on specific posts/pages (this shows a checkbox in the edit view of all public post types (except attachments) to disable lazy loading for an entire post).
  • Process the complete markup of the site.
  • Ein Textfeld, um die Standard-Werte der lazysizes-Konfiguration zu verändern.

* Die unveilhooks-Extension von lazysizes unterstützt mehr als video- und audio-Elemente, aber dafür musst du das Markup selbst anpassen:

  • Background images not inserted with inline styles.
  • Skripte.
  • Stylesheets.

Das Plugin fügt ein noscript-Element als Fallback für deaktiviertes JavaScript ein.

By default, the auto-modifying of the image markup does not work for images that are added using wp_get_attachment_image(), because there cannot be a noscript fallback added. You can enable the option to process the complete markup to make them work.

You can disable lazy loading for elements with specific CSS classes by defining them via the plugin settings (SettingsMediaLazy Loader options). Or use the skip-lazy class or the data-skip-lazy attribute. skip-lazy and data-skip-lazy also work on wrapper elements to exclude the wrapper and its children from being processed.


  • Installiere das Plugin
  • Aktiviere es
  • You can find the plugin settings under SettingsMediaLazy Loader options.


Is there a way to manually call the plugin to modify markup of not-supported image functions?

Yes. See the following example that would generate lazy-load-ready output for the result of the not-supported wp_get_attachment_image() function:

global $lazy_loader;
if ( isset( $lazy_loader ) && $lazy_loader instanceof FlorianBrinkmann\LazyLoadResponsiveImages\Plugin ) {
    echo $lazy_loader->filter_markup( wp_get_attachment_image( 1261 ) );

To make it happen, you need to pass the markup that contains the image (or images) to $lazy_loader->filter_markup(). The if statement ensures that the Lazy Loader object is there and that it is an object of the correct class.

How can I disable/modify the inline styles?

Important: If you modify or remove the inline styles, also the style that shows the loading spinner is affected. So if you remove the styles or modify them without adding back the spinner styles, the spinner option will not work. I created a Gist with the spinner styles – just add them to your modification to make it work.

To disable or modify the plugin’s inline styles (except the style that hides the img.lazyload elements when JS is disabled, so only the noscript version is displayed) you can use the lazy_load_responsive_images_inline_styles filter. For example, to remove the inline styles, use the following code:

add_filter( 'lazy_load_responsive_images_inline_styles', function () {
    return '';
} );

If you want to modify it, you can do that like in the following code block (remember to include the opening and closing style tags for additions/replacements). The code modifies the duration of the fade-in-effect:

add_filter( 'lazy_load_responsive_images_inline_styles', function ( $default_styles ) {
    $default_styles = sprintf(
        '%s <style>:root {
    --lazy-loader-animation-duration: 600ms;

    return $default_styles;
} );

The CSS from the example are the default styles that are used by the plugin (without the loading spinner styles). The display: block for .lazyload is important for the aspectratio plugin option.

How can I adjust the lazy load threshold/other lazysizes settings?

There is a textarea in the plugin settings where you can insert custom settings for the lazysizes config.


12. August 2019
One of the very few plugins I install on all sites. It simply works out of the box, but it also gives all options needed in case you need something special. Other lazyloaders have completely failed, were not detected by Google Audits or missing important configuration options (i.e. skipping sensitive page elements like sliders). Thumbs up for not spamming the admin area but putting the settings where they belong (media settings) as well.
3. Juni 2019
I have tried a dozen lazy-loading solutions - including the 'native' one that comes with Jetpack - and all of them have a downside - usually it's excessive and visible jumping when scrolling down a page as content is rejigged to accommodate images as they load. This is particularly bad if you start at the bottom of a page and scroll up. Lazy Loader avoids this through several successful strategies. First it loads placeholders which mean text and other content is correctly positioned before images load. This works 98% effectively with just a hint of correction as images fill in. Secondly, rather than only loading 'above the fold' content, Lazy Loader also loads some of the page below the fold. This means there it is very rare (at least on a land-line connection) to see the images loading as that all takes place below the viewport. The result works so well I have had to double check that the plugin is actually active as images are loaded pretty much invisibly! Even scrolling down the page fast doesn't seem to catch it out. Cool. A downside to this approach is that GT-Metrix (and, presumably Google bots) will see a slightly larger page than is the case with other lazy loading solutions, so page-load times will be a tiny bit longer. This is a price worth paying in my opinion as the user experience is SO much better. Although there is an option to display a loading spinner while images load I have never been able see this in action as everything loads so fast. Perhaps on a slow mobile connection it might come into play? The only problem I have found with Lazy Loader plugin is a minor conflict with Flex Posts plugin (a brilliant Gutenberg 'show posts' block that provides magazine style posts from particular categories). However, the conflict only affects the Gutenberg editor (back-end), where Flex Posts fails to load posts in the preview. Everything still works on the front end though, so this is just a minor issue. It is easily circumvented by disabling LL whist editing a page with FP blocks, then re-activating it afterwards.
Lies alle 35 Rezensionen

Mitwirkende & Entwickler

„Lazy Loader“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:


„Lazy Loader“ wurde in 1 Sprache übersetzt. Danke an die Übersetzerinnen und Übersetzer für ihre Mitwirkung.

Übersetze „Lazy Loader“ in deine Sprache.

Interessiert an der Entwicklung?

Durchstöbere den Code, sieh dir das SVN Repository an oder abonniere das Entwicklungsprotokoll per RSS.


6.0.1 – 01.05.2020


  • Added empty default value for the $content param of Plugin\filter_markup() method to prevent a fatal error that occurs sometimes when Lazy Loader is used with the Content Cards plugin.
  • Check if there is already a script with the lazysizes handle registered and deregister it before enqueuing own version. Fixes issue with Avada theme that includes own version.

6.0.0 – 31.01.2020

This release requires PHP 7


  • Option to process the complete markup of a page instead of only parts of it via the filters (might take a little longer because the plugin needs to process more markup and, if your site contains HTML errors, lead to unwanted behavior, because the DOM Parser tries to correct that).
  • Option to define additional filters for the plugin to process.
  • Ignore patterns for skip-lazy class and data-skip-lazy attribute. Use them if you want Lazy Loader to ignore an element and its children. The disable-lazyload class and data-no-lazyload attribute will keep working for backwards compatibility. Adding the new class and attribute goes back to an initiative by Frank Goossens, developer of Autoptimize, who reached out to several devs of lazy loading plugins or plugins that also have a lazy loading feature to get a standard class and attribute across multiple plugins.
  • Added donation link to plugin header.


  • Updated required PHP version to 7.0.
  • Security improvements via escaping and specifying allowed HTML in setting descriptions. Thanks @igmoweb
  • Simplified Plugin\add_noscript_element() method. It just clones the source element now, instead of creating a new empty element and adding all attributes to it.
  • Check markup for [caption] shortcode to prevent duplicated images in Elementor.
  • Class properties are private now.


  • Error with invalid attribute names in Plugin\add_noscript_element() method.

5.1.2 – 12.11.2019


  • Updated background image option text.

5.1.1 – 11.11.2019


  • Updated readme.

5.1.0 – 11.11.2019


  • Lazy loading of background images.
  • Lazy loading of videos with autoplay.


  • Updated lazysizes and its extensions to 5.1.2.
  • Updated tested up to version to 5.3.


  • Handle rest api requests with edit context as admin requests (thanks @websupporter!).
  • Check if a post type supports custom-fields before loading block editor script.

5.0.0 – 28.06.2019


  • Increased priority for the calls of the_content and post_thumbnail_html filters from 500 to 10001 to fix issues with the ShortPixel Image Optimizer. So if you use those filters and they need to run after the Lazy Loader, you need to increase the priority, too. This is the change that makes it a major version change.


  • Audio shortcode stripped from frontend with all following content.

4.1.0 – 31.05.2019

Tested with WordPress 5.2


  • Option for using the native loading extension from lazysizes.
  • Textarea for custom lazysizes config values.


  • Updated lazysizes to 5.1.0.
  • Use CSS variable var(--lazy-loader-animation-duration) for duration of fade-in-effect after loading.


  • Do not load assets on pages where Lazy Loader is disabled.
  • Preserve HTML and hex entities.
  • Ignore inline scripts.
  • Skip images that already have a data-src attribute.
  • Checkbox for disabling Lazy Loader not showing for Custom Post Types added via a plugin.

4.0.1 – 20.02.2019


  • Removed debug code.

4.0.0 – 20.02.2019

Tested with WordPress 5.1.

* Renamed object in main plugin file from $plugin to $lazy_loader to make it accessible via the theme.
* Added an example for calling the filter_markup() method of the plugin from the theme to modify markup of not-supported image functions like wp_get_attachment_image().
* Updated lazysizes to 4.1.6.


  • Wrong year in changelog for 3.5.0 and 3.5.1. Thanks @pra85!
  • Correctly remove the plugin options from the options database table on uninstall.

3.5.1 – 28.01.2019


  • Wrong version number in plugin file.

3.5.0 – 28.01.2019


  • Option to disable lazy loading for specific posts/pages via a checkbox. The checkbox can be enabled via an option under SettingsMediaLazy Loader options.
  • Possibility to use the disable-lazyload class to disable the lazy loader for an element and its children.


  • Updated lazysizes to 4.1.5.
  • Added note about limited browser support to loading spinner option.
  • Updated placeholder source to a more stable variation (thanks diegocanal for the hint).


  • Only use save_html() method if markup was modified.
  • Keep srcset attribute with placeholder source to get valid HTML.

3.4.0 – 05.07.2018


  • Support for picture element.


  • Only use data-sizes attribute, if value is auto.
  • Removed unnecessary check for src attribute in modify_img_markup().

3.3.7 – 12.06.2018


  • Disable libxml errors.

3.3.6 – 11.06.2018


  • Set a transparent data URI as img src instead of removing it to avoid page jumps that can happen during image loading (at least in Chrome).
  • Updated lazysizes and plugins to 4.0.4.


  • Fix encoding issues with strings inside script elements.

3.3.5 – 14.04.2018


  • Not working with PHP 5.3.

3.3.4 – 05.04.2018


  • Use correct pattern for lazy loading of video and audio elements.
  • Removed unnecessary else and a chunk of duplicate code (thanks mackzwellz).
  • Issue with encoding of cyrillic characters.


  • Updated lazysizes.js and the bundled plugins to 4.0.2.
  • Run post_thumbnail_html filter later (priority 500, like for the the_content filter call, instead of 10), to fix a problem that appears when used with Responsify WP (thanks jgadbois).
  • Moved the add_noscript_element() method call to the beginning of the modify_*_markup methods. With that, there is no need to remove the lazyload class in the add_noscript_element() method, because it was not added yet.
  • Removed unnecessary $new_iframe->setAttribute( 'src', $src ) call from the add_noscript_element().
  • Removed unnecessary $dom->saveHTMLExact() calls from the modify_*_markup methods.
  • Use own FlorianBrinkmann\LazyLoadResponsiveImages\Helpers()->save_html() method for saving the HTML.

3.3.3 – 13.03.2018


  • Fix broken code blocks in readme file.
  • Set .lazyload to display: block to make the aspectratio option work correctly again.

3.3.2 – 09.03.2018


  • Removed try to get width and height from images without width and height attr with getimagesize because it may cause a PHP warning.

3.3.1 – 09.03.2018


  • Added inline doc for FlorianBrinkmann\LazyLoadResponsiveImages\Settings()->add_color_picker().
  • Only load color picker styles and script if on media settings page.

3.3.0 – 09.03.2018

(there was also a new feature added in 3.2.9, but I forgot to increase the minor version number there…)


  • lazy_load_responsive_images_inline_styles filter for modifying the inline CSS (for modification, you also need to add the opening and closing style tags). If you use the spinner option and the filter, you need to add the spinner styles, because they are part of the filtered CSS (Gist with the spinner styles used by default).
  • Option to display a loading spinner and define its color.


  • Use style inside noscript element to hide .lazyload images if no JS instead of adding a js class via JS to the html element.
  • Using DOMXpath()->query() to fetch the element nodes.
  • Looping the nodes once inside FlorianBrinkmann\LazyLoadResponsiveImages\Plugin()->filter_markup() and no longer one time in each of the three element-specific methods.


  • Do not modify elements inside noscript elements.
  • Doc fixes.

3.2.10 – 06.03.2018


  • Kleiner Fehler in der Readme.

3.2.9 – 06.03.2018


  • Option um das lazysizes-aspectratio-Plugin einzufügen. Das Plugin berechnet den benötigten Platz für die Bilder bevor sie geladen werden. Damit sollte das Lazy Loading auch für Masonry-Grids funktionieren, ohne dass weitere Anpassungen am Markup notwendig sind. Danke an zitrusblau für den Hinweis mit dem Plugin.

3.2.8 – 27.02.2018


  • .lazyload-Bilder korrekt auf display: none setzen, wenn JS nicht aktiviert ist.

3.2.7 – 22.02.2018


  • Die Änderung der Transparenz nach dem Laden der Bilder ist jetzt animiert.


  • In bestimmten Fällen doppelte Bilder, zum Beispiel wenn der the_content-Filter mehrfach läuft.
  • Kleiner Doc-Fix.

3.2.6 – 30.11.2017


  • Die unveilhooks-Erweiterung automatisch laden, wenn die Option für audio- oder video-Elemente aktiv ist, auch wenn die Option zum Laden des unveilhooks-Plugins selbst nicht aktiv sein sollte.
  • Tested up to-Version auf 4.9.1 geändert.

3.2.5 – 27.11.2017


  • Falscher Pfad zu den Plugin-Optionen in der readme.txt.

3.2.4 – 25.11.2017


  • Fataler Fehler durch falsche Groß- und Kleinschreibung des Klassennamens SmartDOMDocument bei der Referenzierung – sorry dafür!

3.2.3 – 25.11.2017


  • Probleme mit Zeilenumbrüchen in der Readme für

3.2.2 – 25.11.2017


  • Problem mit doppelten Bildern im HTML-Widget.

3.2.1 – 25.11.2017


  • Minifizierte Version des unveilhooks-Plugins von lazysizes laden.

3.2.0 – 25.11.2017


  • Option zum automatischen Lazy Loading von iFrames.
  • Option zum automatischen Lazy Loading von video-Elementen.
  • Option zum automatischen Lazy Loading von audio-Elementen.
  • Option, um zusätzlich das unveilhooks-Plugin von lazysizes zu laden. Damit ist Lazy Loading von audio- und video-Elementen, Skripten und mehr möglich.
  • Unterstützung für Bilder in Text- und HTML-Widgets. Funktioniert nicht für Galerien in den Widgets.
  • Unterstützung für Gravatare.
  • Autoloading von Klassen mit Autoloader von Composer.


  • Plugin-Namen in »Lazy Loader« geändert.
  • Einstellungen zur Medien-Einstellungsseite verschoben und die Customizer-Section entfernt.
  • PHP-Kommentarstil für Inline-Kommentare.
  • Klassendateien in src umbenannt.


  • Kleine Dokumentations-Fehler.

3.1.13 – 08.11.2017


  • lazysizes auf 4.0.1 aktualisiert.
  • »Tested up to«-Version auf 4.9 angehoben.

3.1.12 – 22.09.2017


  • Unterstützung des data-no-lazyload-Attributs zur Deaktivierung von Lazy Loading wiederhergestellt (wurde in 3.1.0 entfernt, ohne an die Rückwärtskompatibilität zu denken, sorry).

3.1.11 – 19.09.2017


  • Details dazu in die Readme eingefügt, welche Bilder das Plugin lazy-loaded.


  • Jetzt auch mit noscript-Element für Galerie-Bilder.


  • Kein Lazy-Loading für Bilder, die über wp_get_attachment_image() eingefügt wurden, da für diese Bilder kein noscript-Fallback bereitgestellt werden kann.

3.1.10 – 17.09.2017


  • is_admin_request()-Prüfung funktioniert nicht für Unterverzeichnis-Installationen.

3.1.9 – 25.08.2017


  • Produktbilder erscheinen in WooCommerce-Warenkorb zweimal.

3.1.8 – 10.08.2017


  • »Requires at least« auf 4.5 gestellt, da seit einigen Versionen wp_add_inline_script() genutzt wird.

3.1.7 – 10.08.2017


  • saveHTMLExact()-Methode von SmartDomDocument nutzen um zu verhindern, dass doctype, html- und body-Elemente zum Inhalt hinzugefügt werden.

3.1.6 – 07.08.2017


  • Lazy Loading für AMP-Seiten deaktivieren, die vom »AMP«-Plugin von Automattic erstellt werden.

3.1.5 – 20.07.2017


  • Weitere Proleme mit PHP 5.3.
  • Problem mit Beitragsbildern im Backend, die fälschlicherweise auch vom Plugin behandelt wurden.

3.1.4 – 14.07.2017


  • []-Array-Syntax mit array() ersetzt, damit es auch wieder auf PHP 5.3 funktioniert.

3.1.3 – 07.07.2017


  • Falscher Check auf js-Klasse führt zu versteckten Bildern, wenn nichts anderes diese Klasse hinzufügt.



  • Großes P für ein »WordPress« in der Readme und eins in der Plugin-Beschreibung.



  • Deaktivierungs-Möglichkeit zu Readme hinzugefügt.


  • Korrekte Text-Domain.



  • Customizer-Option um Bilder via Klassenname vom Lazy Loading auszuschließen.


  • Nutzung von semver.
  • Funktioniert nun auch mit AJAX-Requests (Dank an zitrusblau).
  • Klassen und Namespaces.
  • Verwendung der SmartDomDocument-Klasse.
  • Plugin-URL aktualisiert.
  • Verbesserungen der Dokumentation.


  • lazysizes auf 3.0.0 aktualisiert (Dank an FlorianBrinkmann)
  • Plugin-Version spiegelt die lazysizes-Version wider.


  • Erlaubt es, Bilder mit dem »data-no-lazyload«-Attribut vom Lazy Loading auszuschließen (Dank an wheresrhys)


  • Bugfix für fehlende Bilder bei deaktiviertem JavaScript


  • Check hinzugefügt, damit das Plugin nicht mehrfach auf dasselbe Bild angewendet wird (Dank an saxonycreative)


  • Fehlendes src-Attribut eingefügt. Ältere Browser, wie der PS4-Browser, funktionieren jetzt wieder.


  • Verhindert Lazy Loading in Feeds und dem WordPress-Backend.


  • Beschreibung wurde geändert, um die Kompatibilität mit dem Responsive-Images-Feature aus WordPress 4.4 zu kennzeichnen.
  • Skippen des ersten Bildes im Post entfernt.
  • js-Klasse wird für bessere Kompatibilität zu body-Tag hinzugefügt.


  • Pfad zu CSS und JS behoben.


  • Typo in WordPress-Benutzernamen.