Skip to main content
100%

Gist d7d415d1f3401d7b9d482f01706d1b72

✓ Published0🌍 Public
KKopylovVitalik
Last edited Oct 26, 2020
Created on Oct 26, 2020

This example demonstrates a WordPress code snippet that delays the loading of embedded iframe content on single post pages. The PHP filter modifies the post’s content by replacing standard `iframe` `src` attributes with a custom `data-iframe-src` attribute, while the accompanying JavaScript—executed after a 1.3-second timeout—uses `querySelectorAll` to reassign the original `src` to each element via `frame.dataset.iframeSrc`. This technique postpones third-party widget rendering (such as video embeds) to prioritize initial page load, without relying on any external JavaScript libraries or APIs.

AI-generated description

Similar vizzes