wp_iframe_tag_add_loading_attr WordPress Filter Hook

The wp_iframe_tag_add_loading_attr hook is used to add a 'loading' attribute to iframe tags. This hook is useful for iframes that load slow content, such as ads. When the 'loading' attribute is present, the browser will show a loading indicator until the iframe has finished loading.

apply_filters( 'wp_iframe_tag_add_loading_attr', string|bool $value, string $iframe, string $context ) #

Filters the loading attribute value to add to an iframe. Default lazy.


Description

Returning false or an empty string will not add the attribute. Returning true will add the default value.


Top ↑

Parameters

$value

(string|bool)The loading attribute value. Returning a falsey value will result in the attribute being omitted for the iframe.

$iframe

(string)The HTML iframe tag to be filtered.

$context

(string)Additional context about how the function was called or where the iframe tag is.


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More