wp_lazy_loading_enabled
函数
wp_lazy_loading_enabled ( $tag_name, $context )
- 参数
-
-
(string)
$tag_name
The tag name.- Required: 是
-
(string)
$context
Additional context, like the current filter name or the function name from where this was called.- Required: 是
-
(string)
- 返回值
-
- (bool) Whether to add the attribute.
- 定义位置
-
-
wp-includes/media.php
, line 1735
-
wp-includes/media.php
- 引入
- 5.5.0
- 弃用
- –
决定是否在指定的上下文中为指定的标签添加`loading`属性。
function wp_lazy_loading_enabled( $tag_name, $context ) { // By default add to all 'img' and 'iframe' tags. // See https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading // See https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-loading $default = ( 'img' === $tag_name || 'iframe' === $tag_name ); /** * Filters whether to add the `loading` attribute to the specified tag in the specified context. * * @since 5.5.0 * * @param bool $default Default value. * @param string $tag_name The tag name. * @param string $context Additional context, like the current filter name * or the function name from where this was called. */ return (bool) apply_filters( 'wp_lazy_loading_enabled', $default, $tag_name, $context ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。